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.
- Open the authorization request URL in a browser window. Follow these instructions.
- 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
ā
Harendra
1 Like