Skip to content

Commit

Permalink
Add workaround for DNOA OAuth2 error
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Sep 15, 2015
1 parent f115d56 commit 6735321
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ServiceStack.Authentication.OAuth2/OAuth2Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public override object Authenticate(IServiceBase authService, IAuthSession sessi
var authServer = new AuthorizationServerDescription { AuthorizationEndpoint = new Uri(this.AuthorizeUrl), TokenEndpoint = new Uri(this.AccessTokenUrl) };
var authClient = new WebServerClient(authServer, this.ConsumerKey) {
ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(this.ConsumerSecret),
AuthorizationTracker = new DotNetOpenAuthTokenManager(),
};

var authState = ProcessUserAuthorization(authClient, authServer, authService);
Expand Down Expand Up @@ -212,5 +213,18 @@ protected IAuthTokens Init(IServiceBase authService, ref IAuthSession session, A

return tokens;
}

//Workaround to fix "Unexpected OAuth authorization response..."
//From http://stackoverflow.com/a/23693111/85785
class DotNetOpenAuthTokenManager : IClientAuthorizationTracker
{
public IAuthorizationState GetAuthorizationState(Uri callbackUrl, string clientState)
{
return new AuthorizationState
{
Callback = callbackUrl
};
}
}
}
}

0 comments on commit 6735321

Please sign in to comment.