Relative Content

Tag Archive for oauth-2.0google-oauthapache-httpclient-4.xapache-httpclient-5.x

Google Oauth2 exchange code for token returning 400

I am trying to follow https://developers.google.com/identity/protocols/oauth2/web-server#exchange-authorization-code to exchange a code for an access token. I am able to get my local endpoint to trigger and in the controller I run the following. The issue is that I am getting a 400 from ‘https://oauth2.googleapis.com/token’ endpoint. I do not see a response body, which is where would usually look for the error message. Does anyone know how I can debug or what the issue might be? Note that I have ‘http://localhost:8080/oauthtokengmail’ as one of my ‘Authorized redirect URIs’, and that the redirect is working, so I do not think the issue is there.