Created
October 14, 2019 13:28
-
-
Save wilcoschoneveld/63e69e861548df620d302a8a2494d1fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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