我正在尝试注册社交网络,但是当我通过OAuthWebSecurity发送请求时,AuthenticationResult,IsSuccesful为false。
[HttpPost]
[AllowAnonymous]
public ActionResult ExternalLogin(string provider, string returnUrl)
{
return new ExternalLoginResult(provider, Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl }));
}
//
// GET: /Account/ExternalLoginCallback
[AllowAnonymous]
public ActionResult ExternalLoginCallback(string returnUrl)
{
AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl }));
if (!result.IsSuccessful)
{
return RedirectToAction("ExternalLoginFailure");
}
Log4net写道:
2013-08-22 16:20:16,261 (GMT+6) [27] DEBUG DotNetOpenAuth.Messaging.Channel - Incoming HTTP request: GET http://localhost/account/externallogincallback?__provider__=google&__sid__=8bcdd01d279e44ef8ecabbf19e689ab7&dnoa.userSuppliedIdentifier=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2013-08-22T10%3A22%3A02Z-iGxI_3j1iUngw&openid.return_to=http%3A%2F%2Flocalhost%2FAccount%2FExternalLoginCallback%3F__provider__%3Dgoogle%26__sid__%3D8bcdd01d279e44ef8ecabbf19e689ab7%26dnoa.userSuppliedIdentifier%3Dhttps%253A%252F%252Fwww.google.com%252Faccounts%252Fo8%252Fid&openid.assoc_handle=1.AMlYA9Vtl8tOWE1Qt3WZD2701kgGGRxCRoKd7vEqq1gTV5GW1GNs2zOVwyC8a7Dk&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.alias1%2Cext1.value.alias1&openid.sig=JBAcIBr98sjm%2FUHcQLJRXBEqc8c%3D&openid.identity=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawkqgxNrvD9N5RuJgh5iIj_VmzThXh3VnY4&openid.claimed_id=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawkqgxNrvD9N5RuJgh5iIj_VmzThXh3VnY4&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response&openid.ext1.type.alias1=http%3A%2F%2Faxschema.org%2Fcontact%2Femail&openid.ext1.value.alias1=a.k.t%40gmail.com
2013-08-22 16:20:16,291 (GMT+6) [27] ERROR DotNetOpenAuth.Messaging - Protocol error: The openid.return_to parameter (http://localhost/Account/ExternalLoginCallback?__provider__=google&__sid__=8bcdd01d279e44ef8ecabbf19e689ab7&dnoa.userSuppliedIdentifier=https:%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid) does not match the actual URL (http://localhost/account/externallogincallback?__provider__=google&__sid__=8bcdd01d279e44ef8ecabbf19e689ab7&dnoa.userSuppliedIdentifier=https:%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid&openid.ns=http:%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=id_res&openid.op_endpoint=https:%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fud&openid.response_nonce=2013-08-22T10:22:02Z-iGxI_3j1iUngw&openid.return_to=http:%2F%2Flocalhost%2FAccount%2FExternalLoginCallback%3F__provider__%3Dgoogle%26__sid__%3D8bcdd01d279e44ef8ecabbf19e689ab7%26dnoa.userSuppliedIdentifier%3Dhttps%253A%252F%252Fwww.google.com%252Faccounts%252Fo8%252Fid&openid.assoc_handle=1.AMlYA9Vtl8tOWE1Qt3WZD2701kgGGRxCRoKd7vEqq1gTV5GW1GNs2zOVwyC8a7Dk&openid.signed=op_endpoint%2Cclaimed_id%2Cidentity%2Creturn_to%2Cresponse_nonce%2Cassoc_handle%2Cns.ext1%2Cext1.mode%2Cext1.type.alias1%2Cext1.value.alias1&openid.sig=JBAcIBr98sjm%2FUHcQLJRXBEqc8c%3D&openid.identity=https:%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawkqgxNrvD9N5RuJgh5iIj_VmzThXh3VnY4&openid.claimed_id=https:%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid%3Fid%3DAItOawkqgxNrvD9N5RuJgh5iIj_VmzThXh3VnY4&openid.ns.ext1=http:%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_response&openid.ext1.type.alias1=http:%2F%2Faxschema.org%2Fcontact%2Femail&openid.ext1.value.alias1=a.k.t%40gmail.com) the request was made with.
也就是说,它只占用请求的一部分,因此无法授权。可能是什么问题? 提前致谢