I Try to use OAuth 2.0 for google authorize with DotNetOpenAuth library for .NET, the code works on Facebook, but with google when I request callback to google endpoint, after user select a google account, the response only return a Bad Request (status code 400)
My code is like
public class GoogleClient : WebServerClient
{
private static readonly AuthorizationServerDescription GoogleDescription = new AuthorizationServerDescription
{
TokenEndpoint = new Uri("https://accounts.google.com/o/oauth2/token"),
AuthorizationEndpoint = new Uri("https://accounts.google.com/o/oauth2/auth"),
ProtocolVersion = ProtocolVersion.V20
};
public GoogleClient() : base(GoogleDescription) { }
}
Use
GoogleClient client = new GoogleClient
{
ClientIdentifier = ConfigurationHelper.GoogleAppId,
ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(ConfigurationHelper.GoogleAppSecret)
};
client.ProcessUserAuthorization();
We are having the same problem. I have noticed that the scope parameter is included within the redirect_uri parameter in the http post body request (for some strange reason, it is not encoded correctly) I think it is time to move to another lib.