Scopes: https" /> Scopes: https" /> Scopes: https"/>

403 Forbidden when accessing events using Google CalDAV

221 views Asked by At

Stack: Python, caldav library.

I use OAuth2 for authentication and provide access token in all requests:

"Authorization": <access_token>

Scopes:

  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.googleapis.com/auth/calendar.events

I get 403 Forbidden on this request:

REPORT https://apidata.googleusercontent.com/caldav/v2/caldav/v2/<calid>/events 403

But requesting calendars works as expected:

PROPFIND https://apidata.googleusercontent.com/caldav/v2/<email%40gmail.com> 207

  1. My first guess about the problem was invalid scope, but as I use https://www.googleapis.com/auth/calendar.events and grand all requested permissions during authentication, and can access calendars, so that doesn't seem to be the reason.

  2. Next I thought that request method might cause the problem, but REPORT method is supported by Google.

  3. Also I checked if access token is passed in headers in every request and that is not the reason either.

  4. Access token is not stale.


What can be the problem?

1

There are 1 answers

0
Ann S. On

The problem was in the scopes. After I replaced https://www.googleapis.com/auth/calendar.readonly with https://www.googleapis.com/auth/calendar I could access events.