Snippet for "Integrating Google Calendar (G-suite) in Node" https://hackernoon.com/my-journey-integrating-google-calendar-g-suite-in-node-62fbc8596455
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
const google = require("googleapis").google; | |
const calendar = google.calendar("v3"); | |
(async function () { | |
const scopes = ['https://www.googleapis.com/auth/calendar']; | |
const keyFile = './xxxxxxxxxxx.json'; // Your should make it an environment variable | |
const client = await google.auth.getClient({ | |
keyFile, | |
scopes, | |
}); | |
// Delegated Credential | |
client.subject = "melvin@xxxxxxxxx.xx"; | |
const res = await calendar.calendarList.list({ | |
auth: client | |
}); | |
console.log(JSON.stringify(res.data)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment