"keyExpired" in Google Calendar API

2.6k Views Asked by At

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.

1

There are 1 best solutions below

1
On

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