Search code examples
google-apigoogle-calendar-apigoogle-cloud-console

Google Calendar API returning "Daily Limit"


I'm using the nodejs googleapis module to authenticate the google calendar API. I've managed to get an access token. My code is below:

var tok = { 
  access_token: 'ya29.XXXXX-XXXXXXX',
  refresh_token: '1/XXXXXXXXXXX',
  scope: 'https://www.googleapis.com/auth/calendar',
  token_type: 'Bearer',
  expiry_date: 1569089181800 
}
const calendar = google.calendar({version: 'v3', tok});
calendar.events.list({
  calendarId: 'primary',
  timeMin: (new Date()).toISOString(),
  maxResults: 10000,
  singleEvents: true,
  orderBy: 'startTime',
}, (err, res) => {

});

Each time I run this command I get the following error: The API returned an error: Error: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

Can't figure out why this is the case (seeing as it was working before and I've only used a handful of requests). I've enabled billing and enabled/disabled/re-enabled the calendar API in the Google Cloud console.


Solution

  • It appears that the token is expired since the epoch value corresponds to

    Sep 21 2019 17:30:00 UTC/GMT
    

    I think you need a fresh token