How to make the session expire after a browser close in node.js with express?

10,117

From the connect session middleware docs: "we can set req.session.cookie.expires to false to enable the cookie to remain for only the duration of the user-agent."

Share:
10,117
Admin
Author by

Admin

Updated on June 08, 2022

Comments

  • Admin
    Admin almost 2 years

    I am using

    req.session.cookie.maxAge = 14 * 24 * 3600 * 1000 : 0
    

    to let the session expire after two weeks. but now I want to make it expire after a browser close. Is there any way to do it?