Newman command not processing environment variable and display NULL value in cmd

Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

I am sending a POST request to

Redirecting…

Output of this request in Response Body is HTML having access_token.

In Tests, I have added script to fetch the

access_token

from Response Body. When I run POST request in Postman using collection runner it works fine (signifying that test script is working in postman) and Postman Console displays the access token value (which I have added for debugging). But when I run it using newman command, it shows NULL .

That is, access token fetched and passed to environment variable is not processed by Newman hence it passes NULL value during runtime.

Does anybody have idea how to make newman read environment variable value which is set during runtime ?

It seems that newman is unable to store variables due to -

  1. POST request to https://login.xyz.com/zyz/authorize involves redirect requests
  2. Redirect requests works fine in POSTMAN app i.e. there is no trouble in authorizing in between redirect requests
  3. Whereas in newman, I am getting ‘Sign in to your account’ message in printed output body response