Updating environment variables not working

Hello everyone,

I’m experiencing inconsistent behavior when automatically updating environment variables during OAuth 2.0 token refresh.

The problem:

  • My post-request script updates access_token and refresh_token after a successful token refresh
  • Script logs confirm the values are updated
  • Environment UI shows the OLD values (not updated)
  • Subsequent token refresh requests fail with 400 - invalid_grant

What works:

  • Manually copying values from the response to environment variables → no errors on next refresh
  • Same script updating a different environment variable (tested with random endpoint that returns UUID v4, updating a different postman environement) → works perfectly

My theory:
This appears to be environment-specific, possibly related to how OAuth tokens are cached or displayed in the UI? I still struggle to identify what may be preventing values from being automatically updated in my environment, especially since logs seems to indicate that values have been updated correctly (pm.environement.get()).

Questions:
Has anyone encountered this? Is there a known issue with programmatically updating token variables in Postman environments?

Screenshots attached below showing the script output vs. UI state.

Thanks so much in advance!

Request settings

Script

Request response and script logs

Environment values (after request)

1 Like

Thanks @simon-malaret for reporting this and for the detailed explanation.

Could you please confirm which Postman app version you’re currently using? If you’re not already on the latest Postman Desktop app (v11.76.5), could you try upgrading and testing the same workflow again?

I tried reproducing this on my end using the latest version, and the environment variables seem to update correctly for me.

If the issue still persists on v11.76.5, could you please share the Postman logs (as a zip file)? That would help us dig deeper. You can follow the steps here to collect the logs:
https://support.postman.com/hc/en-us/articles/360025298633-How-to-get-logs-from-the-Postman-Desktop-app

Thanks again for raising this — happy to continue investigating once we have the additional details.

Hello Rohan, thanks for investigating!

Updating to the latest version (v.11.76.6) seemed to have resolved the issue for the refresh token request. I confirm that the environment variables are properly updating.

However, weirdly, the behavior remains unchanged for the create access token request.
This request shares the same response schema, and has the same post-request script as the refresh token request.

I will dm you the logs so you can investigate!

Thanks again,

Talk soon

Should be accessible here : One time drop | Securely send files with a one-time link

Thanks for sharing! The link doesn’t seem to be working for me—could you please check or resend it?

Oops sorry about this! This should work: Postman auth issue logs

1 Like

Thanks for sharing the logs!

Given that the behavior still differs between the refresh token and create access token requests, would you be open to a quick call so we can walk through it together and pinpoint the difference? If that works, please use this link to book a time: https://calendar.app.google/wCJ4CqUoB7oQkGt79

Thanks again!

Thanks so much Rohan! I’ve scheduled a call!

1 Like

Hey @simon-malaret, we’ve pushed fixes to address the issue we discussed on our call in the latest Postman release v11.79.4. Could you please update to this version and let us know if it resolves the issue with the create access token request as well?

Appreciate you testing this, and looking forward to your confirmation.