0

I'm using google calendar's node sdk, and I'm doing this call:

const google = require('googleapis');

const calendar = google.calendar('v3');

calendar.events.list({
  auth,
  calendarId,
  maxResults: 2500,
  syncToken: 'COCikJ6a8NgCEOCikJ6a8NgCGAU='
}, (err, data) => {
  console.log(err)
  console.log(data)
});

The problem I'm having is that syncToken is obviated, so I always receive all events.

I don't know if I'm doing something wrong here.

Rafael del Rio
  • 208
  • 2
  • 11

1 Answers1

0

Well it looks like in the example they provide

https://developers.google.com/google-apps/calendar/quickstart/nodejs

they use google-auth-library@0.* and in this library version there's a bug in syncToken.

I uninstalled google-auth-library@0.* and installed last version (applying this changes https://github.com/google/google-auth-library-nodejs/releases/tag/v1.0.0) and everything worked now.

PD: I don't know if someone can close this answer for me.

Rafael del Rio
  • 208
  • 2
  • 11
  • Also found this - https://stackoverflow.com/a/34387466/1594335. Apparently `orderBy` is supported in pagination but since it's a non-supported option with syncs it will prevent a sync token from being included if you list it as an option. Oddly, that restriction doesn't seem to apply to `timeMin`...so not sure which of the non-supported sync properties work and which don't: https://developers.google.com/calendar/v3/reference/events/list – Brock Klein Aug 13 '18 at 22:24