node.js - Why is my session expiring every time I close the browser? -
i set session maxage of express documented.
here code:
app.use(session({ secret: process.env.session_secret, saveuninitialized: true, resave: true, maxage: 1000* 60 * 60 *24 * 365, store: new mongostore({mongooseconnection:mongoose.connection}) }));
but every time close browser, find myself logged out.
also, note using passport local, facebook, , google authentications.
they expire.
in console, can see connect.sid in expires/maxage section lists "session" while other cookies have dates...
what doing wrong?
you need configure express-session, , set maxage
on session-cookie
app.use(express.session({ cookie : { maxage: 1000* 60 * 60 *24 * 365 }, store : new mongostore({mongooseconnection:mongoose.connection}) }); //..... app.use(passport.session());
Comments
Post a Comment