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:
- The account running the auth has Super Admin rights
- Authorization has the scope https://www.googleapis.com/auth/calendar
- I have other “read only” API calls that work just fine.
{
"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));
});