I want to set a session timeout after log in using passportjs. How to set the maxAge for the session using passportjs. What is the default max age for the session that passportjs provide?
You need to set the lifetime of the session cookie for express.session like the following example:
app.use(express.session({
secret : 'your_cookie_secret',
cookie:{_expires : 60000000}, // time im ms
})
);
For testing I recommend a shorter expires time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With