diff --git a/server.ts b/server.ts index f5fbb81..90bae00 100644 --- a/server.ts +++ b/server.ts @@ -57,6 +57,8 @@ app.use( }) ); +app.use(passport.authenticate("session")); + passport.use( new GoogleStrategy.Strategy( { @@ -68,6 +70,7 @@ passport.use( "https://www.googleapis.com/auth/calendar.events.freebusy", ], skipUserProfile: true, // this is important, if not set to true, an error will be thrown + state: true, }, (accessToken, refreshToken, profile, cb) => { console.log("accessToken", accessToken); diff --git a/src/routes/calendarRoutes.ts b/src/routes/calendarRoutes.ts index ac3f793..730b519 100644 --- a/src/routes/calendarRoutes.ts +++ b/src/routes/calendarRoutes.ts @@ -9,7 +9,6 @@ router.get( "/auth/google", passport.authenticate("google", { accessType: "offline", - session: false, scope: [ "https://www.googleapis.com/auth/calendar.app.created", "https://www.googleapis.com/auth/calendar.events.freebusy",