0

I use golang, following the quickstart.go at https://developers.google.com/gmail/api/quickstart/go.

Firstly, it worked fine to list lables. But I found it no ways to grant permission for sending emails, so I revoke the token and try to keep everything reset. After revoking the token, I cannot grant permissions again. It always results in the following error:

Get https://www.googleapis.com/gmail/v1/users/me/labels?alt=json: oauth2: cannot fetch token: 400 Bad Request Response: { "error" : "invalid_grant", "error_description" : "Token has been revoked." }

How can I fix this. Please help me. Thank you.

Clerk
  • 71
  • 2
  • 9
  • I think [SO-10576386](http://stackoverflow.com/questions/10576386/invalid-grant-trying-to-get-oauth-token-from-google) might help. – gerardnimo Feb 09 '16 at 11:37
  • @gerardnimo The assess type is already "Offline" in quickstart.go. I think I need to prompt a page to let the gmail user to grant permission again. But I just have no idea how to do that. – Clerk Feb 10 '16 at 04:57
  • [SO-10576386](http://stackoverflow.com/questions/10576386/invalid-grant-trying-to-get-oauth-token-from-google) seems not work to me. – Clerk Feb 10 '16 at 05:06
  • I checked the code and found the solution: Delete the CacheFile ".credentials" in HomeDir. I search .credentials and delete it and it works. – Clerk Feb 10 '16 at 05:40
  • where is this file – png May 11 '16 at 12:19

0 Answers0