Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
"TypeError: Cannot read property 'set' of undefined" when trying to set environment variable for JWT token in Postman

Clicking the send button should create an environmental variable for the JWT token. However the postman log outputs an error:

enter image description here

enter image description here

Here is the javascript code that should handle creating the access token as an environmental variable within postman.

var jsonData = JSON.parse(responseBody);
tests["Access token was not empty"] = jsonData.access_token !== undefined;

postman.environment.set("jwt_token", jsonData.access_token);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

New test script for postman is

var jsonData = JSON.parse(responseBody);

pm.test("Access token was not empty", () => {
   pm.expect(jsonData.access_token).not.eql(undefined);
});

pm.environment.set("jwt_token", jsonData.access_token);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!