Evgen Stand Evgen Stand - 1 year ago 103
Node.js Question

NodeJS | How to be logined after closing browser using passport and express?

I use in my project express and passport for working with session and it works fine instead of one problem. When i close browser my session deserialized and this is fine, but i need to be logined after connecting again. Should i save information in cookies or use another package in npm? A little bit about my code:

maxAge: new Date(Date.now() + 3600000),
httpOnly: true,
cookie: { path: '/', httpOnly: true, maxAge: null},
store: new MongoStore(
console.log(err || 'connect-mongodb setup ok');


As you can see i use a common passport+express program. Just give me any good tips for searching.

Answer Source

Solution is change cookie: { path: '/', httpOnly: true, maxAge: null} to cookie: { path: '/', httpOnly: true, maxAge: 36000000}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download