Skip to content

Instantly share code, notes, and snippets.

View deviantlycan's full-sized avatar

deviantlycan

View GitHub Profile
/**
* 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);