I have a login request that returns a token that gets saved to environment variables via the following script added in Postman - Tests tab:
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("token_abc", jsonData.access_token);
Another request uses that token in the Authorization header as Bearer {{token_abc}}
.
But, it seems the token is valid only for one-time use: after request #2 is sent, the value of token_abc
is reset to null
in Environment variables - Current value.
What could be causing this? Because this is not how the application usually behaves - the token should be valid for 24 hours. Is there a Postman setting I'm not seeing somewhere? I'm using Postman 8.6.1.