passport.js - Express Session Getting Overwritten -


i have express passport authentication , have added session below.

app.use(cookieparser()); // read cookies (needed auth) app.use(bodyparser()); // information html forms  app.set('view engine', 'ejs'); // set ejs templating  // required passport // trust proxy behind web server. //app.set('trust proxy', 1);  app.use(session({     secret: 'this secret',     resave: false,     store: new mongostore({ url: configdb.url }),     saveuninitialized: true,     cookie: { httponly: true, maxage: 2419200000 } })); // session secret  app.get("/*", function(req, res, next) {     if (typeof req.cookies['connect.sid'] !== 'undefined') { console.log(req.cookies['connect.sid']); }     next(); // call next middleware });  app.use(passport.initialize()); app.use(passport.session()); // persistent login sessions app.use(flash()); // use connect-flash flash messages stored in session 

not sure issue is, in passport login setting session name req.session.name. works fine if user logged in, when user b logs in, doesn't create new session object, overwrites user session object user b including passport details. in browser cookies reset user b, should obvious.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -