Forum Academy Marketplace Showcase Pricing Features

Invalid grant issue Google OAuth2

Has anyone managed to resolve the invalid grant issue when trying to generate an access token using the code retrieved from the Google OAuth2 response?

Code preview: 4/0AY0e-g4eVWen0Waie-OqkA71fpv7vkbJZnDlM53UQWmRaIdW25O5Xue_7PuHxd3bTcrQ

Screenshot - 2021-06-04T123335.421

Did you try this URL
https://oauth2.googleapis.com/token ?
Personnaly, I never put space in parameters. But I don’t know if this can broke something.

You can consider sending the request to a requestbin.com endpoint for testing and debugging

2 Likes

Try this

In addition your body should be a Json object for a post like you’ve shown. You’rs is in a query string format which won’t work. It tries to send a badly formed Json object which is unexpected and not needed. This is likely the badly formed request issue you’re experiencing.

2 Likes