mozilla / node-client-sessions

secure sessions stored in cookies
Mozilla Public License 2.0
759 stars 104 forks source link

Problem with duration #144

Open uinstinct opened 4 years ago

uinstinct commented 4 years ago

Problem with duration

I tried this multiple times and now I really don't understand why this is happening?

const sessions=require('client-sessions'); app.use(sessions({ cookieName: 'usersession', secret:'keeping it secret', duration:1000*60*2, }));

In the above code, the duration shoud be 2 minutes.

But, it looks strange in the cookies storage in my browser.

image

The cookie should expire in 2 minutes.

The browser I am using is Firefox Developer Edition.

I tried the same in chrome but it shows the same.

mi-kas commented 4 years ago

I had the same problem and after setting maxAge to the duration you want, the cookie's expiration was set correctly in the browser.