1

I have a node application and whenever I edit/update a .js file, users are logging out. I'm using passport-local with express.io.

Also I'm using mongoose and socket.io.

app.configure(function() {
    app.use(express.logger('dev'));
    app.use(express.cookieParser());
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({ extended: true }));
    app.set('view engine', 'ejs');
    app.use(express.session({
        key: 'session',
        secret: '111'
    }));
    app.use(passport.initialize());
    app.use(passport.session());
    app.use(flash());

});

How to make users log in forever?


Solved : NodeJS + Express + Mongo Session storage

Community
  • 1
  • 1
Lazy
  • 1,807
  • 4
  • 29
  • 49
  • sessions aren't really supposed to be counted on after a server restart. Try looking into using cookies manually. sessions use cookies, but they aren't the same thing. – Catalyst Sep 06 '14 at 18:48

1 Answers1

1

If you want to keep alive the session restarting node you need a session storage. The default session storage stores data into ram and it's lost at every node restart.

matteospampani
  • 596
  • 4
  • 12