Search code examples
basic-authenticationjwtbearer-token

Web API Authentication Basic vs Bearer


I have created JWT based Authentication in my Web API application. I am not able to figure out the difference between

  1. Basic Token
  2. Bearer Token

Can someone please help me?


Solution

  • The Basic and Digest authentication schemes are dedicated to the authentication using a username and a secret (see RFC7616 and RFC7617).

    The Bearer authentication scheme is dedicated to the authentication using a token and is described by the RFC6750. Even if this scheme comes from an OAuth2 specification, you can still use it in any other context where tokens are exchange between a client and a server.

    Concerning the JWT authentication and as it is a token, the best choice is the Bearer authentication scheme. Nevertheless, nothing prevent you from using a custom scheme that could fit on your requirements. But the custom scheme may be misunderstood by applications.