Can't access google calendar API with multiple domains

1. I needed to fetch google calendar of various clients for my app
2. I created a project in google cloud, activated calendar api scopes in oAUTH2.0 credentials
3. In authorised domains, I put my org email ID.
4. I published the app
5. Now i am able to fetch calendar of all people having domain of getvymo.com but not of gmail.com or any other domain
6. I tried putting gmail.com in authorised domain but it is not allowing me even to access calendar APIs via gmail domain
7. Now i have 50+ clients with 50+ domains, do i need to manually put every client's domain in authorised domain, is n't there a way to auto accept any domain ?

Need urgent help, please help.

0 1 212
1 REPLY 1

Hello!

I'd suggest to implement an ACL[1] by having all your users within a group, then you allow users within this group to fetch the API. i.e. (For python)

rule = {
    'scope': {
        'type': 'group',
        'value': 'app-users@getvymo.com'
    },
    'role': 'reader'
}

 Then whenever a new users joins your service you can add it to the group and independently of the domain will have access to the calendar API. [2]

calendar_id = 'primary'  # or the ID of the calendar you want to modify
calendar_list_entry = calendar_service.calendarList().get(calendarId=calendar_id).execute()
calendar_list_entry['acl'].append(rule)

updated_calendar_list_entry = calendar_service.calendarList().update(calendarId=calendar_id, body=calendar_list_entry).execute()

1 - Acl  |  Google Calendar  |  Google for Developers

2 - Create a group in your organization - Google Workspace Admin Help