Reputation: 1
I'm trying to use the Google Calendar API with a Service Account to retrieve events. However, listing calendars or events returns nothing (not an error, just 0 records returned). There's lots of documentation/examples for domain-wide authorization using G-Suite, but this just an individual Google account -- it is not part of any G-Suite domain.
I did add the email address of the service account to the calendar under sharing, but the calendar still doesn't show when I try to retrieve data.
Is there a certain URL I should be using? Or is there some kind of configuration setting in Google Console I'm missing?
Upvotes: 0
Views: 386
Reputation: 19339
Adding the Service Account's email address is not enough to share the Calendar: the account also has to accept
the Calendar. Looks like this is because of a recent change of behaviour.
From this comment in Issue Tracker:
Due to a recent change of behaviour, any account has to explicitly "accept" a Calendar that has been shared with them. In case of a Service Account, this "acceptance" should be made by adding the calendar to the
CalendarList
via CalendarList.insert.
That is to say, after adding the Service Account address, you have to call CalendarList.insert to add this Calendar to the Service Account's calendar list. In your call, you just have to provide the corresponding Calendar id
in the request body.
Upvotes: 0