I have read the google calendar API docs but I couldn't find a way of inviting guest outside the account's organization, is this possible?
This is my code with the NodeJS client:
const auth = new google.auth.GoogleAuth({
keyFile: 'src/google-api/calendar-auth.json',
scopes: ['https://www.googleapis.com/auth/calendar'],
});
const calendar = google.calendar({ version: 'v3', auth });
calendar.events.insert({
calendarId: 'email-of-organization',
sendUpdates: 'all',
requestBody: {
start: {
dateTime: startDate.toISOString(),
timeZone: 'utc',
},
end: {
dateTime: endDate.toISOString(),
timeZone: 'utc',
},
summary: 'a summary',
description: 'a description',
attendees: [{ email: 'email@outside.org' }], // this email is outside my organization
},
});
The error:
Service accounts cannot invite attendees without Domain-Wide Delegation of Authority
Even if I setup Domain-Wide Delegation, the error persists.