How to set the session timeout after entering the passport data?

I want to set the session timeout after login using passport data. How to set maxAge for a session using passport data. What is the default maximum age for a session that provides passport data?

+9
source share
3 answers

This is handled through the session middleware, for example:

.use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) 

the documentation contains other useful bits that are worth reading for an understanding of session processing.

+20
source

You need to set the session cookie lifetime for express.session as in the following example:

 app.use(express.session({ secret : 'your_cookie_secret', cookie:{_expires : 60000000}, // time im ms }) ); 

For testing, I recommend reducing the expiration time.

+4
source

Error: Most middleware (such as a session) is no longer associated with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware .

Got this using the latest node toolkit ... so this may no longer work.

0
source

Source: https://habr.com/ru/post/950803/


All Articles