Search code examples
jwttoken

What is the reason for adding "bearer " as the prefix to your web token?


I saw a tutorial that does this. But I see absolutely no reason why one would ever need to add a prefix, any prefix, to your JWT token.


Solution

  • Bearer is used in authorization tokens to distinguish it from other types of authentication, such as Basic, Digest, and several others. The Authorization: <type> <credentials> syntax was first described in the HTTP 1.0 spec, long before the concept of a Bearer token was introduced in the OAuth 2.0 authorization standard.