Node.js expressjs sessions are not inserted in Firefox

I use express with nodejs, and sessions are not inserted in Firefox. However, the work is done in Chrome.

I have my maxAge up to 14400000, which, as I read, can be a problem, since my local machine is in GMT mode, but still it does not look.

This is what I configured:

  app.use(express.cookieParser());
  app.use(express.session({ secret: 'mysecret', store: new RedisStore, cookie: { maxAge: 14400000 }}));

I configure it simply:

req.session.user = 'something'

Any ideas what this could be?

Thank!

+3
source share
1 answer

Try using the req.session. regenerate(callback)first session setup. It will look something like this:

app.use(express.cookieParser());
app.use(express.session({ secret: 'mysecret', store: new RedisStore, cookie: { maxAge: 14400000 }}));

var user = //Define your user

req.session.regenerate(function() {
   req.session.user = user;
   res.redirect('/loggedin');
});

Give it a try!

+1
source

All Articles