Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"keyExpired" in Google Calendar API

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.

like image 309
Albert Avatar asked Jan 18 '13 17:01

Albert


People also ask

Is Google Calendar API a REST API?

The Google Calendar API is a RESTful API that can be accessed through explicit HTTP calls or via the Google Client Libraries. The API exposes most of the features available in the Google Calendar Web interface.

What is calendarId in Google Calendar API?

calendarId is the email address of your calendar. If you're just using your own, then use the string "primary". eventId is the ID of the event that you want to modify.


1 Answers

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

  • The OAuth authorization process
like image 187
Paul Sweatte Avatar answered Sep 25 '22 06:09

Paul Sweatte