To fix passport.js passport.initialize() middleware not in use with Node.js, we call app.use
with the middleware returned by initialize
.
For instance, we write
app.use(
cookieSession({
maxAge: 30 * 24 * 60 * 60 * 1000,
keys: [keys.cookieKey],
})
);
app.use(passport.initialize());
app.use(passport.session());
to call app.use
with the function returned by initialize
to add Passport to our Express app.
We call cookieSession
to return a middleware to let us use cookie sessions.