How to resolve error 401 Unauthorized

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Welcome Pranav, to the postman community

There is nothing here related to postman here.

Your token is either invalid or you are not authorized to access this URL.
Kindly take dev help. 401 is valid response for invalid token.

1 Like

@gpub1, Thanks for your concern .
Yes you are right ,
but the scenario is like: If I run the APIs individually its working fine and sending the response 200 OK, but when I run the same APIs in runner it says 401 Error.

as said before either your token is invalid or got expired.
this is because your token need captured to chain the request. Please check this link. To run through runner capture token and pass into header as Authorization Bearer {{TokenVariable}}

Please share the response. This info doesnt help

Thanks

@gpub1
The problem is this for Authorization null value is passed
image

Tokens are 100% valid because it works and shows status 200Ok when I run the same API individually, but when I run it in the runner it shows Error 01 Unauthorized

Pranav thats because there is no Token captured that can chain the request. Pls see the link shared about chaining the requests

What is the response of ur first request kindly share it here, this screenshot is not helping.

Looks as though it’s Unauthorized because expiry etc. But possible that if your using environment variables and inserting the string interpolation {{bearer_token}} in the authorization Bearer token the value of variable needs to be prefixed “Bearer”.
e.g Bearer

Authorization in postman request does it auto but in environment var it does not.

Did you get a solution on this pranav? Cause I am facing the same issue now.