I keep getting an invalid_grant error on trying to get an OAuth token from Google to connect to their contacts API. All the information is correct and I have triple-checked this so I’m kind of stumped.
Does anyone know what may be causing this issue? I have tried setting up a different client ID for it but I get the same result. I have tried connecting many different ways including trying the force authentication, but still the same result.
I ran into this problem when I didn’t explicitly request “offline” access when sending the user to the OAuth “Do you want to give this app permission to touch your stuff?” page.
Make sure you specify access_type=offline in your request.
Details here: https://developers.google.com/accounts/docs/OAuth2WebServer#offline
(Also: I think Google added this restriction in late 2011. If you have old tokens from before then, you’ll need to send your users to the permission page to authorize offline use.)