I’ve got a newbie node.js question about authentication ans sessions.
I’ve made an authentication with: express.js and mongoose-auth (mongodb):
app.use(express.cookieParser());
app.use(express.session({ secret: 'esoognom'}));
app.use(auth.mongooseAuth.middleware());
I’ve got not much understanding of all that staff deeply. After users are authenticated they stay to be so unless server restarts. I want to have more persistent state of authentication, how can I manage this?
Thanks for help.
If you want the sessions to persist even after a server has crashes / restarted then you should use one of the following modules:
You can also set the lifetime of a cookie using the maxAge param when adding the session middleware. For example if we were using connect-mongodb: