I am currently trying to build a Calendar app in Node.JS hooked with Google Calendar. However, I have been struggling with trying to get a Calendar from the Google API. I have downloaded the GoogleApis npm package to assist PassportJS, but I can not seem to get passport to interact with GoogleAPIs. I was trying to find a method of using the already authenticated user to get a Calendar, but google has yielded no results. Is there a way to use Passport.JS to get a Google Calendar, or do I need to abandon PassportJS for this task entirely?
Here is the express route I am currently using to attempt to get a Calendar.
let auth = passport.authenticate('google', {
scope: ['profile', 'email',
'https://www.googleapis.com/auth/calendar.events',
'https://www.googleapis.com/auth/calendar.readonly']
})
/*
I want to know if there is a way to Get The Calendar without the Code below or if I can use Passportjs for the Credentials Section
*/
const client = google.auth.getClient({
credentials: credentials
scopes: ['https://www.googleapis.com/auth/calendar'],
})
calendar.events.list({
calendarId: 'CALID',
...