6

From today my website has a connectivity problem with my GCal. (It’s worked perfectly since from one month).

I call to GCal via jQuery GET:

https://www.googleapis.com/calendar/v3/calendars/{MY_CALENDAR}/events?key={MY_API_KEY}

And the response is (JSON):

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyExpired",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

I not understand why key expired. Can you help me, please? I’ve not read about fixed time life on api key. I haven’t exceeded the daily quota.

Sorry for my English level.

Thanks.

Albert
  • 107
  • 1
  • 4

1 Answers1

1

The keyExpired event is triggered by the OAuth 1.0 process:

If the user approves your application's access request, Google issues an authorized request token. Each request token is valid for only one hour. Only an authorized request token can be exchanged for an access token, and this exchange can be done only once per authorized request token.

OAuth 2.0 has different expiration triggers that are not time-based.

You should write your code to anticipate the possibility that a granted token might no longer work. A token might stop working for one of these reasons:

The user has revoked access.

The token has not been used for six months.

The user changed passwords and the token contains Gmail, Calendar, Contacts, or Hangouts scopes.

The user account has exceeded a certain number of token requests.

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
  • And what then to do? I'm trying to create a new key, but it is immediately expired. And then after a few minutes there are 403 and `accessNotConfigured` error. The last usage of YouTube API on this account was more than 8 months ago. Yes, this is a reason, but how to solve this? Only the creation of a new account is a solution? – Peter Samokhin Mar 21 '20 at 01:53