Reputation: 2291
I've written a website that requires log in using openauth/openID on top of MVC5, using the instruction http://www.asp.net/mvc/tutorials/mvc-5/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on
I've found this technique to be very simple and actually enjoyed the process
Now I'd like to add a REST API that is accessed from a C# application running on a remote PC, such that the applications user interacts with an application and not a browser
What is the technique for doing this? Does C# provide an easy way to pop up a browser such that the authentication happens, cookies collected, but then control is given back to the program?
Upvotes: 2
Views: 696
Reputation: 48279
Actually, there are more oauth2 flows and some of them are better suited for different types of applications.
Specifically, there is authorization code grant flow which is for passive clients (browsers) and it involves showing the logon ui from the identity provider.
However, there is the resource owner password flow which basically consist in passing the username and password in the request and getting the auth token right back. This flow is great for desktop/mobile/native apps where you can even have a custom logon ui at the client side.
There are no native libraries, however implementing oauth2 is possible with the DotnetOpenAuth library.
Upvotes: 1