It's not exactly a good test, but it's something. Need to do some more work in the creation and management of calendars.
27 lines
589 B
JavaScript
27 lines
589 B
JavaScript
const { google } = require('googleapis');
|
|
const { googlePrivateKey, googleClientEmail, googleProjectNumber } = require('./config.json');
|
|
|
|
const SCOPES = ['https://www.googleapis.com/auth/calendar'];
|
|
|
|
async function main() {
|
|
const jwtClient = new google.auth.JWT(
|
|
googleClientEmail,
|
|
null,
|
|
googlePrivateKey,
|
|
SCOPES,
|
|
);
|
|
|
|
const calendar = new google.calendar({
|
|
version: 'v3',
|
|
project: googleProjectNumber,
|
|
auth: jwtClient,
|
|
});
|
|
|
|
const response = calendar.calendarList.list({});
|
|
console.log('Output: ' + response.data);
|
|
}
|
|
|
|
main().catch(e => {
|
|
console.error(e);
|
|
throw e;
|
|
}); |