I try to generate an access token with refresh token in request A
Now the token genrated using req A needs to be set on req B in headers or body ( like access or refresh token)
As these are dynamically generated in the request , its not getting set in req B’s body/header bcoz of which i get 401 as the token isnt passed on to the req B and the variable value remians empty in req B
Note: The same collection runs fine in the postman
You going to need to share some details on how the collection is setup.
In particular on how you are setting the variables for request B.
Collection\Environment, etc.
I would also recommend sharing your Newman command line.
You should be console logging any important variables, and these should be viewable in the Newman console when it runs.
Console log the token in the tests tab (after scripts) for request A.
Then console log the token again in the pre-request (before) scripts for request B.
This should tell you what is not being set and at what point.