我使用mvc6和web api创建一个新的应用程序,使用Angular作为消费者。
我尝试通过包含
来整合Facebook登录 "Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta6"
配置它,并在此后期操作期间调用:
[Route("api/externallogin")]
[HttpPost]
[AllowAnonymous]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
// Request a redirect to the external login provider.
var redirectUrl = Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl });
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return new ChallengeResult(provider, properties);
}
现在,每次我点击上面提到上述方法的按钮,我都会在浏览器上获得此消息(firefox或chrome同样):
XMLHttpRequest cannot load https://www.facebook.com/v2.2/dialog[...]. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:65167' is therefore not allowed access.
(注意:上面的代码片段采用了chrome.Firefox捕获了同样的错误,用不同的词语)
我找不到任何解决方案。任何人都可以帮忙吗?
谢谢!