How to set Access token as an environment variable

I got new access token via Browser using the “Get New Access Token” button in Authorization tab.

Then I clicked “Use Token” and it’s been used in my Authorization tab now.

Is it possible to retrieve this token and set it to an environment variable same way as I would take a value from response and set it to a variable?

I guess the question is how to access the token from Tests tab similarly to pm.response for Response.

I actually think I found it:

pm.request.auth.oauth2.get(“accessToken”)

1 Like