How to Use Bearer Token in Postman for API Authentication
In Postman, you use a
Bearer Token by selecting the Authorization tab, choosing Bearer Token as the type, and then entering your token in the provided field. This token is sent in the Authorization header with your API request to authenticate it.Syntax
The bearer token is sent in the HTTP header named Authorization with the format:
Authorization: Bearer <token>
Here:
Authorizationis the header key.Beareris the authentication scheme.<token>is your secret token string.
http
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Example
This example shows how to set a bearer token in Postman to call a protected API endpoint.
text
1. Open Postman and create a new request. 2. Select the <strong>Authorization</strong> tab. 3. From the <strong>Type</strong> dropdown, select <strong>Bearer Token</strong>. 4. Paste your token string into the <strong>Token</strong> field. 5. Send the request to the API endpoint. Example token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... The request header will include: Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Output
HTTP/1.1 200 OK
{
"message": "Access granted",
"data": {...}
}
Common Pitfalls
- Not selecting
Bearer Tokenas the authorization type causes the token to not be sent correctly. - Forgetting to include the word
Bearerbefore the token in manual headers leads to authentication failure. - Using an expired or invalid token will result in 401 Unauthorized errors.
- Placing the token in the wrong header or body instead of the
Authorizationheader.
http
Wrong way: Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... Right way: Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Quick Reference
| Step | Action |
|---|---|
| 1 | Open Postman and create a new request |
| 2 | Go to the Authorization tab |
| 3 | Select 'Bearer Token' from the Type dropdown |
| 4 | Paste your token into the Token field |
| 5 | Send the request to authenticate |
Key Takeaways
Always select 'Bearer Token' as the authorization type in Postman to send the token correctly.
The token is sent in the 'Authorization' header with the prefix 'Bearer '.
Ensure your token is valid and not expired to avoid authentication errors.
Do not manually add the 'Authorization' header if using the Bearer Token type in Postman.
Use the Authorization tab in Postman for easier and error-free token management.