34
Views
2
Comments
Solved
Is Basic Authentication = Bearer?
Application Type
Traditional Web, Mobile, Reactive, Service

Hi there,

I am wondering is Basic Authentication equals with Bearer in consuming REST API?

regards and thanks

2021-10-09 07-57-44
Stefan Weber
 
MVP
Solution

Hi iBox,

not really. Basic Authentication is a combination of username and password. Basic Credentials can be sent as part of the URL like this http://user:password@domain.com/ or in the Authorization header of an request. When using as a header the value is "Basic" followed by a space and then the base64 encoded value of "username:password".

Bearer Tokens are sent by an Authorization header with a value of "Bearer" followed by a space and then the token value. That token value can be anything, but Bearer tokens are mostly seen in combination with OAuth access tokens and while not mandatory by specification an access token is a Json Web Token that holds information about the token itself, information (aka Claims) of the bearer (your application or the application on behalf of a user) and optionally a signature.

The intention of those access tokens is to give the receiver of a request (an API) enough information that it can both validate the request (by signature validation) and authorize the request (by claims) without performing back queries to a central user database or anything else.

Stefan

2021-10-09 07-57-44
Stefan Weber
 
MVP
Solution

Hi iBox,

not really. Basic Authentication is a combination of username and password. Basic Credentials can be sent as part of the URL like this http://user:password@domain.com/ or in the Authorization header of an request. When using as a header the value is "Basic" followed by a space and then the base64 encoded value of "username:password".

Bearer Tokens are sent by an Authorization header with a value of "Bearer" followed by a space and then the token value. That token value can be anything, but Bearer tokens are mostly seen in combination with OAuth access tokens and while not mandatory by specification an access token is a Json Web Token that holds information about the token itself, information (aka Claims) of the bearer (your application or the application on behalf of a user) and optionally a signature.

The intention of those access tokens is to give the receiver of a request (an API) enough information that it can both validate the request (by signature validation) and authorize the request (by claims) without performing back queries to a central user database or anything else.

Stefan

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.