Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Express Session, Destroying the session after some time?

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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)...

  • If session is timed out: deny the request and redirect to login
  • If session is not timed out: set new session timeout (something like 10 minutes into the future), and reply to request

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!