Edit Google Calendar Events from Google Service Account: 403

Edit Google calendar events from Google service account: 403

I solved it, and the issue was not code, It works fine.

The problem was sharing my calendar. Something that I don't knew.

To allow edit your calendar events from service account, do not have enough with all steps you do in the Google Api Console, you have to give permission from your calendar configuration (Calendar configuration -> Share this calendar) to the email account specified into Google Api Console (email adress).

This can be a problem if it's a business account, then you will have to contact the account administrator.

The code shown here works correctly, so I hope it helps someone, just remember that you must use 475 version of the Google Api Client.

You can find at this link: http://google-api-php-client.googlecode.com/svn/trunk/src/

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. 284XXXXXXXX@developer.gserviceaccount.com.

I can now update my calendar from my web service.

403 error when receiving Google Calendar API notification

It seems like this HTTP 403 raised because of failed verification of CSRF token. So, use csrf_exempt--Django doc decorator to skip the verification process

#views.py
from django.views.decorators.csrf import csrf_exempt

@csrf_exempt # This skips csrf validation.

def GoogleAPIWatchView(request):
...
# do something useful

Google Calendar API - Forbidden - Error with Service Account

'endTimeUnspecified' => true,

is causing your problem (its googles fault, but you cant tell them that)

if you change to

 'end' => [
'dateTime' => $start2,
'timeZone' => $timezone,
],

it will work (i know it is not what you want and maybe you can figure out a way to adjust $start2 to give you what you want as an end time but the endTimeUnspecified is what is causing it to say 403 forbidden

Cannot create events in google calendar with service account

You appear to have forgotten to specify which user you want the service account to delegate to.

from google.oauth2 import service_account

SCOPES = ['https://www.googleapis.com/auth/calendar']
SERVICE_ACCOUNT_FILE = '/path/to/service.json'

credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)

delegated_credentials = credentials.with_subject('user@example.org')

Google Calendar with G Suite account insert get 403

You are missing impersonation.

The purpose of granting domain-wide authority to a Service Account is for these accounts to be able to access data on behalf of users in the domain.

If you grant it domain-wide authority but are not "impersonating" any account, the Service Account is acting as if you hadn't granted this authority: it is trying to access its own Calendars, Drive files, etc., or in this case, trying to insert an Event: something which the Service Account cannot currently do, as I guess you already know.

When the Service Account impersonates another user in the domain (that is, when it acts on behalf of the user), the Service Account can access the resources this user can access. Nothing more, nothing less. What makes delegation useful is that it can do this with any user in the domain.

To impersonate another user, you have to specify this user's email address. I don't know which library you are using, if any, but here you can see how to impersonate another user with Python, Java, and plain HTTP/REST. Refer to this answer if you need to do it in the Node.js library. If you are using another library, look for the corresponding method in the library documentation.

Reference:

  • Delegating domain-wide authority to the service account

403 forbidden response when changing color of event in subscribed calendar

Answer:

The Code: 403 Message: Forbidden error indicates that the account that is trying to edit the calendar event does not have edit access to the calendar. You must change this in the calendar share settings.

More Information:

There are four options for sharing calendars with individuals, as can be seen in the Calendar UI:

Sample Image

Unless the individual has Make changes to events or Make changes and manage sharing access to the calendar, then this Forbidden response will be received.

Note:

As per the documentation on handling Calendar API errors:

403: Forbidden for non-organizer

The event update request is attempting to set one of the shared event properties in a copy that isn't the organizer's. Shared properties (for example, guestsCanInviteOthers, guestsCanModify, or guestsCanSeeOtherGuests) can only be set by the organizer.

While this error's details appear to be different than the much simpler 403: Forbidden error you describe, this could be due to an API change. If you attempt to change one of the properties specified here (guestsCanModify, for example), without the aforementioned calendar sharing settings, then the same, simpler 403 error is returned:

{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}

It is therefore recommended that you check the sharing settings for the calendar, as colorId can not be edited by a user that is not the organiser without this set correctly.

References:

  • Handle API Errors | Calendar API | Google Developers
  • Sharing and Attendees - Inviting Attendees to Events


Related Topics



Leave a reply



Submit