The remote server returned an error: (400) Bad Request Microsoft.AspNet.Membership.OpenAuth

妖精的绣舞 提交于 2020-01-24 15:13:47

问题


I'm using Microsoft.AspNet.Membership.OpenAuth when I create a new asp.net webform .net 4.0 and I config AuthConfig.cs:

OpenAuth.AuthenticationClients.AddFacebook(
                appId: "my appId",
                appSecret: "my appSecret");

In Facebook app config: Website with Facebook Login: http://www.tindep.com

But when I login with facebook it's error:

Server Error in '/' Application.
The remote server returned an error: (400) Bad Request.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[WebException: The remote server returned an error: (400) Bad Request.]
   System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +283
   System.Net.WebClient.DownloadString(Uri address) +100
   DotNetOpenAuth.AspNet.Clients.FacebookClient.QueryAccessToken(Uri returnUrl, String authorizationCode) +235
   DotNetOpenAuth.AspNet.Clients.OAuth2Client.VerifyAuthentication(HttpContextBase context, Uri returnPageUrl) +142
   DotNetOpenAuth.AspNet.OpenAuthSecurityManager.VerifyAuthentication(String returnUrl) +239
   Microsoft.AspNet.Membership.OpenAuth.OpenAuthManager.VerifyAuthentication(HttpContextBase context, String returnUrl) +116
   Microsoft.AspNet.Membership.OpenAuth.OpenAuth.VerifyAuthentication(String returnUrl) +82
   EVNSoft.Website.Account.RegisterExternalLogin.ProcessProviderResult() +205
   EVNSoft.Website.Account.RegisterExternalLogin.Page_Load() +24
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +9808229
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055 

Although Google, Twitter, msdn login successful (Check tindep.com/Account/Login.aspx) It's only error at hosting (tindep.com/Account/Login.aspx). localhost:57846/Account/Login.aspx login facebook success.

Please, help me find cause.

Thanks alot of!


回答1:


There was a defect open related to this: https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/203

but that library is apparently no longer being maintained: https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/317#issuecomment-29580565

... although it is still referenced in many Microsoft documents. Investigating that related to another defect.

See also: facebook login using oauth fails on live server



来源:https://stackoverflow.com/questions/19433383/the-remote-server-returned-an-error-400-bad-request-microsoft-aspnet-membersh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!