Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending JWT token in the headers with Postman

I'm testing an implementation of JWT Token based security based off the following article. I have successfully received a token from the test server. I can't figure out how to have the Chrome POSTMAN REST Client program send the token in the header.

postman screenshot

My questions are as follows:

1) Am I using the right header name and/or POSTMAN interface?

2) Do I need to base 64 encode the token? I thought I could just send the token back.

like image 685
Diode Dan Avatar asked Jul 12 '14 05:07

Diode Dan


People also ask

How do I pass a JWT token in headers?

We can send this token to other endpoints. This can be done easily. We have to add an authorization header in our request and this will be a Bearer TOKEN. To avoid any manual copy-pasting of JWT token, we can use variables to add a script in the Tests tab of API request which is generating token.

How do I send access token in header Postman?

Click Get access token. Postman starts the authentication flow and prompts you to save the access token. Select Add token to header. Click the name of your token so Postman will add the token to the authorization header and click Send to make your request.

How do I send Bearer Token in header Postman?

Bearer token The token is a text string, included in the request header. In the request Authorization tab, select Bearer Token from the Type dropdown list. In the Token field, enter your API key value. For added security, store it in a variable and reference the variable by name.


2 Answers

For the request Header name just use Authorization. Place Bearer before the Token. I just tried it out and it works for me.

Authorization: Bearer TOKEN_STRING

Each part of the JWT is a base64url encoded value.

like image 123
Mick Cullen Avatar answered Sep 17 '22 23:09

Mick Cullen


Here is an image if it helps :)

Postman

Update:

The postman team added "Bearer token" to the "authorization tab": Updated postman

like image 35
prasanthv Avatar answered Sep 21 '22 23:09

prasanthv