Table of contents
Definition
A bearer token is an Access Token passed to a server using the HTTP Authorization [→] header.
Use Cases and Examples
This cryptographic string can be generated based on a special algorithm or generated randomly. It's used primarily for authorization [→], for example, in other to gain access to an API.
Here is what a sample request containing a bearer token request header looks like:
01: curl -X 'POST' \
02: 'https://acme-analytics.xyz/api/v1/submit-consent/demo-12345' \
03: -H 'accept: application/json' \
04: -H 'ACME-API-KEY: demo-abcd' \
05: -H 'Content-Type: application/json' \
06: -H 'Authorization: Bearer <token>` \
07: -d '{
08: "collectIP": true,
09: "collectBrowserInfo": true
10: }'
In the above example code, we have the Authorization: Bearer
as part of the POST request header. In this case, the user will typically replace
with their actual token.
This token will be provided to them directly or instructions on how to generate one will be provided.
Summary
See this article on the difference between JWT and bearer tokens [→]
Here is another article you might like 😊 What Is A Bug?