I’m working with an OAuth-like flow where I:
- Send a
POST
request to/authorise/authenticate
with credentials. - That request responds with a
302
redirect to aGET
URL like:
https://example.com/?code=abc123&state=xyz
I’m running this as part of a Postman collection (potentially via Newman later), and I need to extract the code
parameter from that redirected GET URL.
But I’ve found that Postman:
- Follows redirects automatically
- Does not expose the final redirected URL in the response object
- Doesn’t allow me to access it in scripts (pre-request/test)
Is there any way (via scripting, settings, or workarounds) to catch that code
from the redirect URL inside Postman?
Just in case - the ultimate goal is to make this collection run fully headless (no UI interaction) so we can integrate it into our CI/CD pipeline using Newman.