Google API Error List


Please Share


There are only a handful of Errors that get returned when using the Google APIs.   Most of them are Open Authentication (Oauth / Oauth2) related.      I am going to build a list of the errors and their probable causes and possible solutions.


Open Authentication Errors

invalid_grant

  1. Your server’s clock is not in sync with NTP. (Solution: check the server time if its incorrect fix it. )
  2. The refresh token limit has been exceeded.       (Solution: Nothing you can do they cant have more refresh tokens in use)
    Applications can request multiple refresh tokens. For example, this is useful in situations where a user wants to install an application on multiple machines.  In this case, two refresh tokens are required, one for each installation. When the number of refresh tokens exceeds the limit, older tokens become invalid. If the application attempts to use an invalidated refresh token, an invalid_grant error response is returned. The limit for each unique pair of OAuth 2.0 client and is 25 refresh tokens (note that this limit is subject to change). If the application continues to request refresh tokens for the same Client/Account pair, once the 26th token is issued, the 1st refresh token that was previously issued will become invalid. The 27th requested refresh token would invalidate the 2nd previously issued token and so on.

invalid_client

Make sure that you have both product name and an email address set up in Google Apis Console

Invalid_client Google Api Error

subscriptions are in a suspended state

[412] Errors [ Message[You cannot sign up for Google Apps because one or more of your subscriptions are in a suspended state.]

Solution: Check Google developers console and check your billing options. I think either your credit card has expired or you forgot to pay your bill.

Your account is suspended so you cant make any requests.

Links to question on SO:  Subscriptions are in a suspended State error

invalid_grant: Code was already redeemed

This error requires a little explanation. When the user clicks authenticate you are given an authentication code. You take this code and exchange it for your access token and refresh token.

invalid_grant: Code was already redeemed

Means that you are taking an authentication code that has already been used and trying to get another access token / refresh token for it. Authentication code can only be used once and they do expire so they need to be used quickly.

Invalid_grant: bad request

Normally means that the client id and secrete you are using to refresh the access token. Was not the one that was use to create the refresh token you are using.

Try and authenticate again get a new refresh token.

{“error”: “invalid_grant”, “error_description”: “Bad Request”}

Conclusion

There are a large number of undocumented errors with authenctating to Googles Oauth servers. I have been keeping this list for years in the hopes that i can save you some time.

… More to come as I remember them Feel free to post your error code and its solution if you have one i don’t have listed.

Please Share


Linda Lawton

About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as an application developer and a database expert. I have also been working with Google APIs since 2012 and I have been contributing to the Google .Net client library since 2013. In 2013 I became a a Google Developer Experts for Google Analytics.

Leave a comment

Your email address will not be published. Required fields are marked *