Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda