Question:
Why does Nylas require the full calendar scope specifically when using the primary keyword, even though Google’s own API allows primary calendar event access with the calendar.events.readonly scope?
the primary query parameter requires the reading of calendar attributes, and that requires the specific https://www.googleapis.com/auth/calendar scope. SInce all you’re doing with https://www.googleapis.com/auth/calendar.events.readonly is reading events (objects) from the calendar, these are actually two distinct operations.
Currently we are using google’s native calendar APIs to read the calendar events and it’s working fine when the primary calendarId is used to fetch the events with the only the https://www.googleapis.com/auth/calendar.events.readonly scope.
However, when we try to do the same with Nylas we need to have broader scope. Here are the code snippets for better clarity
When you use calendarId: 'primary' with Nylas, Nylas makes an additional API call to resolve “primary” to the actual calendar ID before fetching events. This resolution call hits a different Google API endpoint that requires broader scopes.