This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This snippet can be used in postman to read the cotnents of a | |
* JWT and set a postman variable to the value of one of the claims | |
*/ | |
let jsonData = pm.response.json(); | |
// use whatever key in the response contains the jwt you want to look into. This example is using access_token | |
let jwtContents = jwt_decode(jsonData.access_token); | |
// Now you can set a postman variable with the value of a claim in the JWT | |
pm.variable.set("someClaim", jwtContents.payload.someClaim); |