Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda