I started to configure google calendar on my new application. I almost made an exact copy of the authentication code displayed at google developers ( https://developers.goog
You should reuse the access token you get after the first successful authentication. You will get an invalid_grant
error if your previous token has not expired yet. Cache it somewhere so you can reuse it.
I was having a similar problem caused by the time on my server being incorrect. Make sure your system clock is synchronised.
I had a similar issue. The problem with "invalid_grant" is that it's basically a placeholder for any error that occurs in relation to the token. I found this article to be really helpful.
You'll also receive this error if you mistakenly try to authenticate your ID Token, rather than your Access Token.
So don't be like me - Make sure you pass the correct token into your code!
Go to your Google API Console ( https://code.google.com/apis/console/ ) and revoke your Client Secret under Client ID for installed applications.
Be sure to also update your code with the new Client Secret