Using OAuth 2.0 Tokens with Team Workspaces and different environments

  • In our Team Workspace we have a Collection that has Authorization set to use OAuth 2.0.
  • All folders/requests in this collection use Inherit from Auth

Managed tokens (created from Get New Access Token) are isolated to each user’s instance of Postman BUT the actual Access Token field on the Collection is not.

So we could use an environment/global variable for that field. However the issue here is that I don’t see a way to

  • access Access Tokens as variables
  • or the fields in them (access token, refresh_token) as variables or programmatically using something like pm.variables.get("variable_key");

So the only way to get these values into env variables is by manually copy/pasting them.

Ironically this is actually EASIER to do when I don’t use the built in OAuth 2.0 flow because using a regular request I can at least programmatically set those variables by scripting them in Tests for a request.

Additionally I cannot manage tokens per environment.

Am I missing something or manually copy/paste the only way to get returned access token data into variables?

I’ve bumped into a similar situation. We have a different OAuth server for each environment, yet it appears like I can only setup a single OAuth provider regardless of the environment.

I tried making multiple collections and assigning different Authorization clients to each one, but when I update the client in one collection, it gets updated in the others. Very frustrating.

1 Like

Token management has always been and continues to be an issue. Vote here: https://github.com/postmanlabs/postman-app-support/issues/6115

and/or here: