1

Initial situation:

  • In one of my python app, we use a service account to call Google Calendar API.
  • User can share their calendars with my service account via its proper email address
  • User also put shared calendars ids on my system
  • On my system, i have a proper calendars ids with proper permissions from shared calendars with my service account
  • I am trying to accept shared calendars with me by calendar id via Calendar Api with this endpoint https://developers.google.com/calendar/v3/reference/calendarList/insert?authuser=1
  • I am not using G-Suite for service account

Current issue:

  • When i accept shared calendar via API it returns the correct response with external calendar data but actually not inserting calendar to my list. I think it's through access role returned in response accessRole=reader and looks like i don't have writer permissions from the service account.

I am using oauth2client and googleapiclient libraries to authenticate my service account.

16
  • You shouldn't require that users share their calendars with a service account. You should be using Oauth2 to authenticate to a users calendar. Service accounts are for preapproving access to an account you the developer own. Calendar list is populated by you. If you want something in that you need to do calendarlist.insert its not going to be inserted in automatically Commented Oct 9, 2020 at 10:21
  • So I assume you're calling CalendarList: insert with your service account after the calendar has been shared by the user through the UI? How do you know the calendar is not getting inserted? Are you using CalendarList: list or CalendarList: get to check that? Commented Oct 9, 2020 at 11:14
  • @lamblichus. So I assume you're calling CalendarList: insert with your service account after the calendar has been shared by the user through the UI? - correct. When i am inserting shared calendar via API to my list i want to see that it was added in UI too, not only check through CalendarList: list. So i was testing only through the UI. Commented Oct 9, 2020 at 12:26
  • DaImTo. If you want something in that you need to do calendarlist.insert its not going to be inserted in automatically - Yeah, i am doing inserting on BE after user saves his calendar id on my system. Commented Oct 9, 2020 at 12:30
  • A service account is not you. If you're using a service account by itself (not using impersonation), the calendars are not getting added to a regular user's list, but to the service account's list. And this list cannot be viewed via UI, only through the API. So my guess is that the calendars are actually added to the service account, but you are not looking at the right place. Can you check whether CalendarList: list returns the list of calendars? Also, why are you using a service account? Do you want the calendars to be shared with your regular account instead? Commented Oct 12, 2020 at 13:46

1 Answer 1

0

Issue:

You're sharing some Calendars with a service account, and you cannot see those Calendars on the UI.

Answer:

A service account, unlike regular accounts, does not have a Calendar UI. If you're looking for these Calendars on your regular account's UI, you won't find them, since the service account is not you. But this doesn't mean these have not been shared. The only way to see which Calendars are in the service account's CalendarList is to list them through the API (see CalendarList: list).

With that said, if your purpose is to be able to see the shared Calendars on the UI, you have to share them with a regular (that is, a user) account, either via API or directly through the UI.

Further reading:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.