Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the session timeout after log in passportjs?

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?

like image 801
Jetson John Avatar asked Aug 01 '13 10:08

Jetson John


1 Answers

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.

like image 186
Bernhard Avatar answered Oct 11 '22 14:10

Bernhard