I am trying to embed a facebook login using a token. I created a new project in VS 2013 and selected individual user account authentication, as in this tutorial http://www.asp.net/web-api/overview/security/external-authentication-services .
I configured facebook authentication:
app.UseFacebookAuthentication( appId: "123[...]", appSecret: "123[...]");
And everything is working fine.
My testing method:
[OverrideAuthentication] [HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)] [Route("ExternalLogin2", Name = "ExternalLogin2")] public async Task<IHttpActionResult> GetExternalLogin2() { ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity); return Ok(); }
I do not understand how [HostAuthentication (DefaultAuthenticationTypes.ExternalBearer)] works.
I call the GET request in a script:
GET http://localhost:17353/api/Account/ExternalLogin2 HTTP/1.1 Authorization: Bearer [my facebook token] Content-Length: 28 Host: localhost:17353
But I get the result 401.
What should I do for authentication with an external media token?
authentication asp.net-mvc asp.net-web-api owin
Neshta
source share