Node.js/Express.js session management cookie to be session cookie
11,749
app.use(express.session({cookie: { path: '/', httpOnly: true, maxAge: null}, secret:'eeuqram'}));
The above worked. So by setting maxAge to be null, I did manage expressjs to use session cookies. Phew.
Author by
Ustaman Sangat
Primarily I work with Java. However, I also use C++ and C# from time to time. I am interested in Functional programming and have been learning Haskell and Scala. Lately, I have also been using javascript (nodejs, backbone, express, require, underscore, etc). Professionally, I have worked mostly in commerce and finance industries since 2006.
Updated on June 15, 2022Comments
-
Ustaman Sangat almost 2 years
How can I make the connect.sid cookie itself only a session cookie instead of a persistent one?
I unsuccessfully tried
app.use(express.session({cookie: { path: '/', httpOnly: true}, secret:'eeuqram'}));
But the cookie still had the expiration timestamp.
-
Alfred over 12 yearsI guess you should accept your own answer so that topic can be closed.
-
Ustaman Sangat over 12 yearsI will.. it seems I have to wait for at least 24 hours before accepting my own answer.