postman

Use postman to get a token from a request and send it to another


I am using postman to do some testing on a REST API.

To login I use a post request who respond with a token I need to keep to use it with another request.

I did it that way : enter image description here

and then I want to use it in another request who need that token in the header :

enter image description here

I seems that it's not sending the token. What am I doing wrong ?


Solution

  • The problem was that I was using postman.setEnvironmentVariable() instead of postman.setGlobalVariable().

    I found the answer here