Skip to content

Instantly share code, notes, and snippets.

@max8hine
Last active November 29, 2018 20:20
Show Gist options
  • Save max8hine/f237ea14c0f07a8cefbd295bfca96f2a to your computer and use it in GitHub Desktop.
Save max8hine/f237ea14c0f07a8cefbd295bfca96f2a to your computer and use it in GitHub Desktop.
req.session and cookie
// https://github.com/jdesboeufs/connect-mongo#readme
// https://docs.mongodb.com/manual/tutorial/expire-data/
/* A session cookie is just a normal cookie without an expiration date.
Those are handled by the browser to be valid until the window is closed or program is quit.
But if the cookie is a httpOnly cookie (a cookie with the httpOnly parameter set),
you cannot read, change or delete it from outside of HTTP (meaning it must be changed on the server). */
cookie: { originalMaxAge: null, expires: null, httpOnly: true, path: '/' }
cookie: { path: '/', _expires: 2018-12-09T10:13:33.883Z, originalMaxAge: 864000000, httpOnly: true }
// =====
// https://stackoverflow.com/questions/21764563/connect-mongo-expiration-time
// https://github.com/jdesboeufs/connect-mongo/issues/46
/*
https://www.npmjs.com/package/express-session
https://github.com/keystonejs/keystone/issues/4494
Settings object for the session ID cookie. The default value is { path: '/', httpOnly: true, secure: false, maxAge: null }.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment