I am using a service account and Google Calendar v3 API to invite domain internal guests to events. I am getting a Encountered 403 Forbidden with reason "quotaExceeded"
error. But, from the console, no API limit is reached and the error disappears when I stop inviting guests.
The Google Cloud Platform project, which holds the service account, is well related to my domain according to settings available in Google Cloud Platform console, in the section: API & Services > Domain verification.
Besides, all my guests have G Suite accounts, related to my domain, and I have enabled G Suite domain-wide delegation in my service account's settings.
I thought this would be enough to prevent the API error due to guests invites. I am aware of the API limits listed here : https://support.google.com/a/answer/2905486?hl=en which I think should be fine, namely the one mentioning limit for inviting external guests, which is not my case.
But it appears I missed something in the settings, and my internal guests are still considered external, would you have any recommendation about how to proceed to fix this? What else should I check?
Here is the code I use to create events with the service account, in python:
SERVICE_ACCOUNT_FILE = 'path/to/service_account.json'
SCOPES = [
'https://www.googleapis.com/auth/calendar.events',
'https://www.googleapis.com/auth/spreadsheets'
]
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE,
scopes=SCOPES
)
service = discovery.build('calendar', 'v3', credentials=credentials)
service.events().insert(
calendarId='my_calendar_id',
body=event_body,
sendUpdates="none").execute()