Reputation: 932
I'm developing a system which consists of a few components:
Site\app users should be able to login there using their Facebook account. My current understanding of the process is the following:
The site\app makes request to Facebook to get access token. Once user confirms to pass his\her details to my application my site\app receives the authentication token.
The site\app passes the token to my RESTful API
API validates the token by sending a request to facebook with the secret. Then the user can be created\authenticated, api generates access token for the user. I do not see any reason to make requests each time user tries to access API.
I'm thinking about best way to implement this. ASP.NET MVC 4 has OAuth support out-of-the box, but it works only if you do everything inside MVC application. DotNetOpenAuth has built in FacebookClient class, but it assumes the same think. I do not want to expose the secret outside API for security reasons.
As last stand option we can implement this by making direct requests to facebook, but I wonder if there are any better options? Can DotNetOpenAuth be utilised for this two step process?
Upvotes: 2
Views: 367
Reputation: 354
Asp.Net Web api supports external logins and this is supported via the Owin pipeline. There are providers for all the popular social networks and can be easily setup for your api. In this case the flow of the app would be as below
You can find a sample implementing the same here
Upvotes: 0