Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bearer token in postman

Tags:

postman

I'm not sure if those 2 images are from the same Postman application or not but the Bearer Token feature only came in on version 5.3.0.

You can just manually add an Authorization Request Header with a Bearer <my_token> value.

This is just a dummy value for demo purposes - The actual value should be Bearer + your token value.

Auth Header

That should work without the need to use that option from the drop down list. This would only just replicate automatically, what you would be doing manually anyway.


I am using Postman v7.0.9.

Add accessToken variable to postman environmental variable.

enter image description here

Then use Tests tab to write javascript.

enter image description here

let jsonData = pm.response.json();
let token = jsonData.accessToken;
pm.environment.set('accessToken', token);

If you are usign the current version "Bearer Token" type is under Authorization tab.

enter image description here


You have a some options to add authorization type:

1) Go headers tap and add => key: Authorization value:Bearer

2) Create collection > select authorization

3) click code and add headers

enter image description here

headers:
{
  'Postman-Token': '55..',
  'cache-control': 'no-cache',
  'Authorization': 'Bearer eyJhbG...'
}

Feb, 2021 - Following worked for me

From the type, choose 'Bearer Token'.

Enter Token in the field as shown below in screenshot:

enter image description here