Reputation: 1309
I'm in the middle of an implementation of Thinktecture IdentityServer and am adding the capacity for mobile apps to provide natively obtained Facebook access tokens to the server, which will respond by locally authenticating the user.
IdentityServer uses Microsoft's Owin middleware to do the Facebook authentication. This is how it gets added to the app:
var fb = new FacebookAuthenticationOptions
{
AuthenticationType = "Facebook",
SignInAsAuthenticationType = signInAsType,
AppId = "...",
AppSecret = "..."
};
What I want to do, off in another class, is call this:
await [FacebookAuthenticationProvider instance].Authenticated(context);
But I can't figure out how to get the FacebookAuthenticationProvider
instance that I need. Or is that even necessary? Can I just new
one up?
Upvotes: 4
Views: 383
Reputation: 17956
I haven't done this specifically but if I understand your issue, I would implement their user service below
https://identityserver.github.io/Documentation/docs/advanced/userService.html
And after that I would assume it authenticates the same way normal ASP.NET does and you could check the Request.IsAuthenticated or User.Identity properties to pull information.
Again, I haven't done this but I would assume that the call to Facebook to actually authenticate would be triggered by some sort of link and that you would have registered with Facebook an external login callback URL that would hit one of your controller actions (at which point authentication logic gets performed), but I'm guessing that user service implementation takes care of most the work for you and you would just hook into it.
If you are looking for caching the token, maybe have a look at -
Upvotes: 2