403 Forbidden message when calling the v3 Google Calendar API using a Service Account via OAuth 2.0

Solved, thanks to this post.

You have to share the calendar from your Google Calendar account with the Service Account email that is generated in the Google API Console, e.g. [email protected].

I can now update my calendar from my web service.


I was also getting the same error even after sharing the calendar as in the Justin's answer. After comparing with another working sample figured out that I have set

var SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"];

instead of

var SCOPES = ["https://www.googleapis.com/auth/calendar"];

Hope this helps anyone who has done a similar mistake and getting this error.