【问题标题】:The remote server returned an error: (400) Bad Request Microsoft.AspNet.Membership.OpenAuth远程服务器返回错误:(400) Bad Request Microsoft.AspNet.Membership.OpenAuth
【发布时间】:2013-10-17 17:29:21
【问题描述】:

当我创建新的 asp.net webform .net 4.0 并配置 AuthConfig.cs 时,我使用的是 Microsoft.AspNet.Membership.OpenAuth:

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

在 Facebook 应用配置中: 使用 Facebook 登录的网站:http://www.tindep.com

但是当我用 facebook 登录时出现错误:

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 

虽然谷歌、推特、msdn登录成功(查看tindep.com/Account/Login.aspx) 这只是托管错误(tindep.com/Account/Login.aspx)。 localhost:57846/Account/Login.aspx 登录facebook成功。

请帮我找出原因。

非常感谢!

【问题讨论】:

  • 也在寻找这个解决方案。

标签: facebook dotnetopenauth


【解决方案1】:

存在与此相关的缺陷: https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/203

但该库显然已不再维护: https://github.com/DotNetOpenAuth/DotNetOpenAuth/issues/317#issuecomment-29580565

...尽管它仍然在许多 Microsoft 文档中被引用。调查与另一个缺陷相关的问题。

另见:facebook login using oauth fails on live server

【讨论】:

  • 对于一个无知的外部观察者,注意到在微软放弃旧的开源项目的同时,具有类似功能集的新微软产品中也出现了完全相同的缺陷,它看起来像微软合并这直接转化为专有的闭源营利性产品。
猜你喜欢
  • 2010-12-13
  • 1970-01-01
  • 2013-04-20
  • 2012-12-25
  • 1970-01-01
  • 2020-06-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多