我试图实现Facebook登录使用外部承载令牌。我在VS 2013中创建了一个新项目,并选择了个人用户帐户认证,如在这个调查http://www.asp.net/web-api/overview/security/external-authentication-services中。Facebook登录使用外部承载令牌(MVC4 Web Api)
我配置了Facebook验证:
app.UseFacebookAuthentication(
appId: "123[...]",
appSecret: "123[...]");
各项工作的罚款。
我的测试方法:
[OverrideAuthentication]
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
[Route("ExternalLogin2", Name = "ExternalLogin2")]
public async Task<IHttpActionResult> GetExternalLogin2()
{
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
return Ok();
}
我不知道如何[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)的作品。
我调用GET请求小提琴手:
GET http://localhost:17353/api/Account/ExternalLogin2 HTTP/1.1
Authorization: Bearer [my facebook token]
Content-Length: 28
Host: localhost:17353
但我收到401结果。
我必须通过外部承载令牌进行身份验证吗?
你在哪里得到来自Facebook的令牌? –
@Neshta你在这里找到了解决方案吗? – Syska
这里同样的问题。我有一个Facebook标记,但无法访问标有外部承载的WebAPI方法。 – creatiive