Skip to content Skip to sidebar Skip to footer

Javascript: Google Calender + Gapi: Service Account

My app makes use of Firebase to log users in, and they have access to a calendar, which is especially created as a single common calendar to add and remove reservations. The app ha

Solution 1:

I resolved this... The problem was in the gapi request, when fetching the events. I was using the wrong calendarId. I had its value set to the default 'primary', but the actual calendarId to be used, can be found under the Google Calendar Settings >> Integrate Calendar. In my settings, the calendarId was the associated account's email address.

So the gapi request looks like this:

const fetchTimeLimit = newDate(2019, 0, 1).toISOString();

let events = await gapi.client.calendar.events.list({
  calendarId: 'calendar_email@gmail.com',
  timeMin: fetchTimeLimit,
  showDeleted: false,
  singleEvents: true,
  maxResults: 300,
  orderBy: 'startTime'
})
.then(response => {  ........etc

Post a Comment for "Javascript: Google Calender + Gapi: Service Account"