Where can I find the code for Postman OAuth 2.0, it generates access token without redirecting to the default redirect uri which is fantastic!

I’m looking for code for Postman OAuth 2.0, it strips out the auth code before redirect and generates oauth access token which is pretty amazing!

1 Like

Hi Hiren,

The code for this is not open source, but I can put a simplified version of the algorithm here.

  1. Open the authorization request URL in a browser window. Follow these instructions.
  2. Every-time the URL changes, check if the new URL is the registered callback URL. If the URL matches, check the query parameters for the field code and close the browser window. If you using electron, you can use some of the events on webcontents like:
did-get-redirect-request
will-navigate
did-navigate
did-navigate-in-page

You might want to use multiple events since there is no single event which is fired for all different types of websites/web-apps.

Hope this helps :slight_smile:


Harendra