I'm interesting to close (logout/sign out) all the user sessions in nodeJS.
req.logout()
is closing only the current session of the user. But for my security panel I want to add the option to close ALL the user sessions. How can I do this?
I'm using MEAN.JS framework. With passport.js library and mongoDB to save the sessions:
// Express MongoDB session storage
app.use(session({
saveUninitialized: true,
resave: true,
secret: config.sessionSecret,
cookie: {
maxAge: 15778476000,
httpOnly: true,
secure: false
},
key: 'sessionId',
store: new mongoStore({
db: db.connection.db,
collection: config.sessionCollection
})
}));
Thank you very much.