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.
@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
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.
Hello there, did you find a solution for this issue?
You should probably start your own topic and provide specific information on your particular issue.
Use screenshots. Show us how you are creating and consuming the bearer token. Show us how you are storing the variables.
The issue will be specifically related to how you are doing this in your request. There will be a mistake in there somewhere.
For anyone trying to check if a JWT token is valid. You should be able to pass the token to the following function and it will break it down into the individual elements, which will include the expiry date, so you can triple confirm that the token is active. Put it in a pre-request script and console log the result. Itβs also useful when a token end point only returns the token, and doesnβt include the expiry date as well.
function parseJwt(token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(atob(base64).split('').map(function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
return JSON.parse(jsonPayload);
}