Zhockos
Zhockos

Reputation: 5

How to get Postman using "x-auth-token" not "Authorization" bearer?

I'm getting token from a request and I'm saving it as environment variable and would like to use it in every other request as then I don't have to manually change it. But the requests want "x-auth-token" header in the request but my token is going under Authorization header.

All the best! Thanks!

Upvotes: 0

Views: 2439

Answers (1)

Danny Dainton
Danny Dainton

Reputation: 25851

You can just manually add in the x-auth-token header with your token value, to the Request Headers section. Set the Auth tab to No Auth so it's also not trying to add something extra as part of the request.

Or you could add this at the Collection level on a Pre-Request Script to add the header to any request that you make.

pm.request.headers.add({key: 'x-auth-token', value: pm.environment.get('token')})

Upvotes: 0

Related Questions