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

179
Views
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 answers
Answer question

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 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!