ASP.NET MVC 4 OAuthWebSecurity not working

In my ASP.NET mvc 4 application, I tried to implement the Account / ExternalLogin i configured,

  • Microsoft (Windows Live),
  • Facebook with ClientID and ClientSecret and enabled by GoogleOpenAuth unfortunately nothing works.

    Url call: provider = microsoft & sid = 95b923de889e4a4db6861c98fafb42a3 & code = f85770b1-266b-3abd-4c46-8d62fe3014dc "> http://mydomain.com/account/externallogincallback? Provider = Microsoft & c . = f85770b1-266b-3abd-4c46-8d62fe3014dc

    Authentication Result Result = OAuthWebSecurity.VerifyAuthentication (Url.Action ("ExternalLoginCallback", new {ReturnUrl = returnUrl}));

All OpenAuth calls do not work, Google will return with false authentication, Facebook and Microsoft (Windows Live) give 400 bad responses to the request.

Can anyone suggest how to resolve this?

More: This is the DLL I used

  • C: \ Users \ username \ documents \ Visual Studio 2012 \ Projects \ MyProject \ packages \ DotNetOpenAuth.AspNet.4.0.3.12153 \ Lib \ net40 packed \ DotNetOpenAuth.AspNet.dll
  • C: \ Users \ username \ documents \ Visual Studio 2012 \ Projects \ MyProject \ packages \ DotNetOpenAuth.Core.4.0.3.12153 \ Lib \ net40 packed \ DotNetOpenAuth.Core.dll
  • C: \ Users \ username \ documents \ Visual Studio 2012 \ Projects \ MyProject \ packages \ DotNetOpenAuth.OAuth.Core.4.0.3.12153 \ Lib \ net40 packed \ DotNetOpenAuth.OAuth.dll
  • C: \ Users \ username \ documents \ Visual Studio 2012 \ Projects \ MyProject \ packages \ DotNetOpenAuth.OpenId.Core.4.0.3.12153 \ Lib \ net40 packed \ 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> 

A problem was discovered: Well, I realized that I had a special function that was launched when the application was launched, which will provide the full URL in lower case, and when the OAuth token is called back to Facebook, the token value will also be reduced, which creates a problem. Glad I could find out :)

+4
source share
1 answer

Not sure what the reason is without seeing the real code, but double check that the return URL you pass to RequestAuthentication () is exactly the same as the one you pass VerifyAuthentication ()

+1
source

All Articles