What are the causes of the "invalid grant" error for Google Analytics?

There are several cases where Google will return "Invalid grant" errors.
  1. The user has revoked your app's access.
  2. The refresh token has not been used for six months.
  3. The user changed passwords and the refresh token contains Gmail scopes.
  4. The user account has exceeded a maximum number of granted (live) refresh tokens.


The most common reason is when user account has exceeded a maximum number of granted (live) refresh tokens. 
This happens when a  single user connects more than 50 Google Analytics accounts. Once the 51st connection is added the limit will be exceeded and the new refresh token will automatically invalidate the oldest connected Google Analytics Data Source without warning. If you attempt to add another Google Analytics Data Source, the process repeats itself and the next oldest connection will have a token that's invalidated. Therefore  anytime a single user connects more than 50 Google Analytics accounts they will encounter the "invalid grant" error. This API limitation is permanent and can not be changed.
Note that the limitation of 50 connected accounts also includes other services, where you have Google Analytics connected - not just inside Databox.


To work around this limitation we suggest limiting the number of Google Analytics accounts connected by any one user. For example, you might connect 25 with one user and then start connecting additional Google Analytics accounts with different users. 
When a Google Analytics Data Source hits the "Invalid grant" error, you can reconnect the Source with a user that has the needed permissions to this account. To do this login on our Webapp, go to Data Manager, search for the affected Data Source and hit Reconnect:


Note that the oldest account connected will then disconnect.

More can be read here:  Google Analytics Token Expiration
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us