使用OAuthWebSecurity.RegisterMicrosoftClient的错误请求(400)

Bru*_*oLM 8 c# authentication oauth dotnetopenauth

我在用Microsoft.Web.WebPages.OAuth.我能注册Google,Facebook,Twitter,Stack Exchange,MyOpenID...

现在我想添加Microsoft Live,所以我注册了:

OAuthWebSecurity.RegisterMicrosoftClient("applicationID", "key");
Run Code Online (Sandbox Code Playgroud)

并呼吁

OAuthWebSecurity.RequestAuthentication("microsoft", Url.Action("Authorization", new { returnUrl = "/" }));
Run Code Online (Sandbox Code Playgroud)

到目前为止一切正常,我被重定向到登录页面.问题是我回来的时候

OAuthWebSecurity.VerifyAuthentication();
Run Code Online (Sandbox Code Playgroud)

它说:

远程服务器返回错误:(400)错误请求.

我需要做什么?

Bre*_*een 0

您使用的重定向域是什么?我发现(在这样做时),由于我指定了我的实际域名,所以我需要让域名指向本地站点。

为了解决这个问题,我在主机文件中添加了一个条目,将我的域指向 127.0.0.1(即因为我正在本地调试和运行)。