Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
140
rated 0 times [  145] [ 5]  / answers: 1 / hits: 9099  / 4 Years ago, thu, april 23, 2020, 12:00:00

I will get the JWT token as response i need to set that JWT token as environment variable in postman
this is my code



pm.test(access_token is working, function () {
var jsonData = pm.response.json();
pm.expect(jsonData.access_token).to.exist;
});

pm.environment.set(jwt_token, pm.test);


and when ever the JWT token changes the postman environment variable should set as that new value


More From » postman

 Answers
4

This would be all you need to set the token:



pm.environment.set(jwt_token, pm.response.json().access_token)


Ensure that you have an environment created and selected in the drop down, in the top right of the app before making the request.


[#4053] Tuesday, April 21, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jadyngraysons

Total Points: 455
Total Questions: 109
Total Answers: 98

Location: Trinidad and Tobago
Member since Fri, May 8, 2020
4 Years ago
jadyngraysons questions
Sat, Jan 18, 20, 00:00, 4 Years ago
Tue, Dec 31, 19, 00:00, 4 Years ago
Wed, Dec 11, 19, 00:00, 5 Years ago
;