Scope issue Calendar API

I'm developing a connection with the Calendar API for our users. We want to read the free/busy events and write our own events in a separate calendar. 

When selecting the scopes in the OAuth Consent screen setup this should all be possible with the following scopes:

  • auth/calendar.app.created
  • auth/calendar.calendarlist.readonly
  • auth/calendar.freebusy

The first problem I found is the SDK of Google (PHP) only has placeholders/constants for the general Calendar (readonly) scopes. Why is this? Are the scopes I selected deprecated?

Second problem looks like the scopes are not working. When I try to list the calendars to have the ids for the freebusy request I get a response of insufficient permission.

Am I doing this al wrong and should ask permission for the auth/calendar scope? I really don't want to do this as we don't want to see the contents of our user's events.

0 1 1,402
1 REPLY 1

@ngroot Here is a solution that i have found online please check if it helps:

The scopes you have selected - auth/calendar.app.created, auth/calendar.calendarlist.readonly, and auth/calendar.freebusy - are not deprecated, and they should allow you to achieve your goal of reading free/busy events and writing your own events in a separate calendar.

Regarding the PHP SDK of Google, it is possible that the SDK only has placeholders/constants for the general Calendar (readonly) scopes because these are the most commonly used scopes for calendar-related operations. However, you can still use the auth/calendar.app.created, auth/calendar.calendarlist.readonly, and auth/calendar.freebusy scopes in your code by manually specifying them.

Regarding the insufficient permission error you are receiving when trying to list the calendars, it is possible that you need to make sure that the user has granted your application the necessary permissions. In addition to requesting the correct scopes, you also need to make sure that the user has actually granted your application access to their calendar data. You can do this by redirecting the user to the OAuth Consent Screen and asking them to grant your application the necessary permissions.

It is possible that you may need to ask for the auth/calendar scope if you are still encountering issues with insufficient permissions. However, if you only need to read free/busy events and write your own events to a separate calendar, you can still achieve this without needing to see the contents of the user's events by using the auth/calendar.app.created, auth/calendar.calendarlist.readonly, and auth/calendar.freebusy scopes.

In summary, you should make sure that you have requested the necessary scopes, and that the user has granted your application the necessary permissions.

If it is still not helpful, I would recommend it in the google workspace developer section such that they may might be able to help you better:

https://www.googlecloudcommunity.com/gc/Workspace-Developer/bd-p/workspace-dev

 

 

Top Solution Authors