0

What is conventional time to set (MaxAge) for my cookies in my Rest Api and I am using connect-mongo package to save the session on My mongodb, How do i destroy of delete the session from my mongodb once the user logged out.

The setup for my cookie is

app.use(session({
    secret: 'secret',
    resave: false,
    saveUninitialized: true,
    store: new MongoStore({
        mongooseConnection: mongoose.connection
    }),
    cookie: {
        maxAge: 60000 * 30
    }
}));

And the for the authentication am using passport

  • Possible duplicate of [NodeJS logout all user sessions](https://stackoverflow.com/questions/33740117/nodejs-logout-all-user-sessions) –  Dec 05 '18 at 11:59
  • Can you suggest the MaxAge for the cookie that is convetional for web dev please – Sadiq Mustapha Aji Dec 05 '18 at 12:20
  • it\`s up to your requirement, but I think it is perfect. i.e `60000*30`, it will be enough, –  Dec 05 '18 at 12:24

0 Answers0