ProcessUserAuthorization in Google OAuth2.0 is throwing 400 error

Viewed 237

I'm having an issue with a line of code in c# to make a OAuth2.0 request. The code is like this:

            WebServerClient consumer = new WebServerClient(CGmail.serverGmail, CGmail.clientIDGmail, CGmail.clientSecretGmail);
            consumer.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(CGmail.clientSecretGmail);
            IAuthorizationState grantedAccess = null;
            try
            {
                    grantedAccess = consumer.ProcessUserAuthorization(Request);
            }
            catch (Exception ex)
            {   
            }

the line grantedAccess = consumer.ProcessUserAuthorization(Request); is throwing the following error:

error

This was working fine until yesterday, I haven't done any change to this functionality. Does anyone know what could happend?.

1 Answers

We also suddenly had this problem. I suspect it had something to do with Google changing some of their OAuth2 endpoints or deprecating some scopes. Still not terribly sure what caused it to break specifically. I couldn't get DotNetOpenAuth to work with any changes to scopes and endpoints, but i'm admittedly not an expert in OAuth2.

To fix it, we just used Google.Apis instead of DotNetOpenAuth.

Related