Get URL parameters from future GET request

My question:

Hello, I have been trying to get a token from a post request:

Post https://auth.mysite.com/oxauth/login

The body includes username and password, when I send this request from the console I can see 4 requests being sent:

Post https://auth.mysite.com/oxauth/login
Get https://auth.mysite.com/oxauth/authorize?scope
Get https://auth.mysite.com/oxauth/authorize?scope=Email+permission
Get https://auth.mysite.com/#/login-callback/&access_token=9180228c-ef88-43d4-bh83-7fe587542f06

I need to find a way to get that access_token and save it in an environment variable, I’m new in postman and I don’t know how to access a chain response like that one.

I have tried with this one

const responseJson = pm.response.headers.get(‘location’);

console.log(Response URL: ${responseJson});

console.log(pm.request.url.query.toObject())

but both are empty

The OAuth flow is a bit more special since it involves a browser and a callback to Postman. I doubt you can grab the callback parameters from scripts with pm.request.

Do you have any other suggestions that I can take a look?

It would help if you could add more details regarding what you are actually trying to accomplish with Postman and some screenshots showing what you have tried so far.

thanks for the awesome information.