i have a login/logout system with express sessions. Im storing my sessions in my mongo database. I want to end the session to make user logout automatically after sometime how can i achieve that?
One common method is to set an expiration time on the session, you could set a timestamp value in mongo for this.
On request check that the session id hasn't timed out (time_now < timestamp)...
You can prevent the user from being auto logged out by having your front end send a request in the background on an interval shorter than the session timeout window.