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

182
Vistas
ReactJS + Firebase Session Persistence. Keep persistence until last tab is closed?

Having a bit of an issue currently. I have a user management system set up where you can log in and etc using firebase. Currently we have the firebase persistence set to local so you are able to open new tabs and still be logged in on the new tab. However I have a use case where I want to log out a user once all tabs are closed.

Case 1: User logs in, opens new tab is logged in on both tabs

Case 2: User logs out new tab and is still logged in on original tab (Also close original and be logged in on new tab)

Case 3: User closes all tabs or closes browser. When going back to the web app they should be logged out

I have tried firebase persistence set to session however this does not allow for new tabs as you will be logged out when opening a new tab.

Any ideas or suggestions on a method on getting around this?

Thank you

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Did you tried to use localStorage to store like a counter of opened tabs. While closing if this counter is 1, do a callback before closing (for ex in hooks, on the useState, return is called while component is destroying), then erase the local storage, call the API to revoke the token ?

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