Search code examples
asp.net-mvcoauth-2.0securitydotnetopenauthoauth2client

OAuthWebSecurity.IsAuthenticatedWithOAuth - Method not found


I'm implementing an OAuth2Client and when I call

var result = OAuthWebSecurity.VerifyAuthentication();

I result.IsSuccessful is equals to false. I've seen that "OAuthWebSecurity.IsAuthenticatedWithOAuth" method has the following exception:

'Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.IsAuthenticatedWithOAuth' threw an exception of type 'System.MissingMethodException' "Method not found: 'Void DotNetOpenAuth.AspNet.OpenAuthSecurityManager..ctor(System.Web.HttpContextBase)'." " at Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.GetIsAuthenticatedWithOAuthCore(HttpContextBase context)\r\n at Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.get_IsAuthenticatedWithOAuth()"

Why?


Solution

  • I'm going with an workaround... In my scenario I have only one OAuth Client, so if I cast it to my client I can verify authentication.

    var result = ((MyOAuth2Client)OAuthWebSecurity.GetOAuthClientData("my")
    .AuthenticationClient).VerifyAuthentication(HttpContext, Request.Url);