Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using OAuth 2 with desktop c# Application

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.

like image 533
Gabriel Duarte Avatar asked Dec 25 '22 00:12

Gabriel Duarte


1 Answers

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

like image 88
Vilmantas Baranauskas Avatar answered Dec 28 '22 06:12

Vilmantas Baranauskas