I am working on a mean.js application, and using the following code for session timeout:
app.use(session({
saveUninitialized: true,
resave: true,
secret: config.sessionSecret,
store: new mongoStore({
db: db.connection.db,
collection: config.sessionCollection
}),
cookie: { maxAge : 1800000 },
rolling: true
}));
It is working perfect. The issue is that when the session expires the page remains in the same state and if the user clicks on any of the links it redirects to the login page.
I need to implement that instead of user click if the session is expired the page should auto redirect to the login page.
Thanks in advance.