Trying to update a calendar event, with Googles API. It's not working out for some reason... It's just telling me "forbidden", and I can't find anything on Googles error handling documentation that matches this error message.
A few important key points:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
The data I'm trying to send:
let data = {
'start': {
dateTime: event_data.start.dateTime //This data is correct and is formatted to rfc3339
},
'end': {
'dateTime': new Date().toISOString()
}
};
return new Promise((resolve, reject) => {
xhr.onreadystatechange = (e) => {
if (xhr.readyState !== 4) {
return;
}
if (xhr.status === 200) {
resolve(JSON.parse(xhr.responseText));
} else {
console.warn('request_error');
}
};
xhr.open('PUT', 'https://www.googleapis.com/calendar/v3/calendars/'+calendar_id+'/events/'+event_id);
xhr.setRequestHeader('Authorization', 'Bearer ' + access_token);
xhr.send(JSON.stringify(data));
});
Okay so the problem relies with updating rights for Google Workspace accounts itself. Allowing up to 48 hours for the changes to take effect is what was necessary here, at the time of writing the post I had only waited around 12-14 hours.
Now that I've waited the up to 48 hours, it works without having to change anything with the code. I couldn't find where Google specifies how long these updates take, but it's consistent with other Google services as well that sometimes waiting up to 48 hours is actually necessary.
To summarize: