问题
I'm accessing the Google Calendar API and authenticating with a service token to a calendar owned by an apps-for-domains account. When I call calendar.events.list, I get the response:
{ kind: 'calendar#events',
etag: [snip],
summary: [snip],
description: [snip],
updated: '2014-11-16T12:33:06.434Z',
timeZone: 'Europe/London',
accessRole: 'reader', <------ this is the problem
defaultReminders: [],
nextSyncToken: [snip],
items: [] }
I would like to be able to write to the calendar. The token's accessRole
is reader
. How do I grant the service token writer
access to the calendar? I have tried using the Google Calendar web UI to give "Make changes AND manage sharing" access to the service-token's email address, but it automatically changes to "See all event details" when I save.
回答1:
The web UI will only allow you to share the calendar with users from the same domain as your Google Apps account. In order to use the service account, you have to give it permission in the Apps Admin, as described here (in the step 4 the name of the option is wrong, I can't remember it exactly, but it's the 3rd link in the page).
来源:https://stackoverflow.com/questions/26957048/google-calendar-api-service-token-only-has-reader-accessrole