Let's assume we request a JWT token from one endpoint and want to use it as Bearer Token in another request to a different endpoint.
We can:
-
1. store the output (or part of it) in an environment variable
-
2. we need to make sure an environment variable with this name exists in the currently selected Postman environment
-
3. we can use the variable anywhere in Postman with
{{myvar}}
- i.e. in the Authorization header
Now run the first request, then the second. It should work as expected.
For debugging use console.log()
and view
-> open postman console
Tags: Postman, Request Chaining, Request Piping, Piping, Chaining, Variable, Variables, Environment Variable, Pipe, API, Token, JWT