Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wilcoschoneveld/63e69e861548df620d302a8a2494d1fc to your computer and use it in GitHub Desktop.
Save wilcoschoneveld/63e69e861548df620d302a8a2494d1fc to your computer and use it in GitHub Desktop.
// Create a new GoogleAuth instance with service-account credentials from a json file.
// Note: credential file location must be set in GOOGLE_APPLICATION_CREDENTIALS env variable
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/calendar'],
clientOptions: {
// Overwrite JWT subject to 'impersonate' calendar user
subject: '[email protected]'
}
});
this.calendar = google.calendar({
version: 'v3',
auth: await auth.getClient()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment