在我的ASP.NET MVC 4应用程序中,我尝试实现“帐户/外部登录”功能,我已经配置了:
Microsoft(Windows Live), Facebook和GoogleOpenAuth,并启用了ClientID和ClientSecret,但不幸的是什么都没有起作用。
URL调用:provider = microsoft&sid = 95b923de889e4a4db6861c98fafb42a3&code = f85770b1-266b-3abd-4c46-8d62fe3014dc">http://mydomain.com/account/externallogincallback?provider = microsoft&sid = 95b923de889e4a4db6861c98fafb42a3&code = f85770b1-266b-3abd-4c46-8d62fe3014dc
所有OpenAuth调用均失败,Google将返回身份验证错误,Facebook和Microsoft(Windows Live)会给出400个错误请求响应。
有人能建议如何解决这个问题吗?
更多细节: 这些是我使用的DLL:
C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.AspNet.4.0.3.12153\lib\net40-full\DotNetOpenAuth.AspNet.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.Core.4.0.3.12153\lib\net40-full\DotNetOpenAuth.Core.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.OAuth.Core.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OAuth.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.OpenId.Core.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OpenId.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.OpenId.RelyingParty.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OpenId.RelyingParty.dll
Web.config
Microsoft(Windows Live), Facebook和GoogleOpenAuth,并启用了ClientID和ClientSecret,但不幸的是什么都没有起作用。
URL调用:provider = microsoft&sid = 95b923de889e4a4db6861c98fafb42a3&code = f85770b1-266b-3abd-4c46-8d62fe3014dc">http://mydomain.com/account/externallogincallback?provider = microsoft&sid = 95b923de889e4a4db6861c98fafb42a3&code = f85770b1-266b-3abd-4c46-8d62fe3014dc
所有OpenAuth调用均失败,Google将返回身份验证错误,Facebook和Microsoft(Windows Live)会给出400个错误请求响应。
有人能建议如何解决这个问题吗?
更多细节: 这些是我使用的DLL:
C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.AspNet.4.0.3.12153\lib\net40-full\DotNetOpenAuth.AspNet.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.Core.4.0.3.12153\lib\net40-full\DotNetOpenAuth.Core.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.OAuth.Core.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OAuth.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.OpenId.Core.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OpenId.dll C:\Users\UserName\Documents\Visual Studio 2012\Projects\myProject\packages\DotNetOpenAuth.OpenId.RelyingParty.4.0.3.12153\lib\net40-full\DotNetOpenAuth.OpenId.RelyingParty.dll
Web.config
<compilation debug="true" targetFramework="4.5" >
<assemblies>
<add assembly="WebMatrix.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="WebMatrix.WebData, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
找到了问题: 我想通了,我在应用程序启动时触发了一个自定义函数,它会强制将完整的URL转换为小写,并且当OAuth令牌回调到Facebook时,令牌值也是小写的,这就导致了问题。很高兴我能找到它 :)