I never used oauth before, so i wanted my app to open a url on system's default browser, then the user logs in, authorize, etc etc and then i need to send back the authorization code to my application, is there a way to do it? i'm using Trakt's API.
1 Answer
There are multiple options, here are some of them:
- use a custom URL scheme for a callback URL, e.g. "myapp://callback/after/oauth";
- deliver authorization code inside of the browser title and watch the browser window title from your application;
- temporary start a webserver from within your application and use a callback URL "http://localhost:port/".
Google recommends #2 and #3 for desktop applications. #1 is normally used for mobile: https://developers.google.com/accounts/docs/OAuth2InstalledApp
2 Comments
Nicolas Raoul
Would you have a link showing what Google says exactly? Thanks!
Potion
How would I do option 2 or 3 for a macOS app? I found this answer by Manos (stackoverflow.com/questions/38268175/…) but I cannot find an httpListener
codeis directly delivered to the application