ReactFix
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • React
  • React Native
  • Programming
  • Object Oriented Programming

Saturday, November 12, 2022

[FIXED] How can I persist user's logging in more than 1 hour in firebase in react native?

 November 12, 2022     firebase, firebase-authentication, javascript, react-native   

Issue

I tried to persist user's logging in from after user logged in to before user logged out but 1 hour after logging in user using Firebase, problem that firebase.auth().currentUser became null occurred. in this situation How do I keep the user logged in?


Solution

How do I keep the user logged in?

As explained in the documentation on Authentication State Persistence, with the JS SDK, by default a signed in user is indefinitely persisted until explicit sign out. So normally you should not do anything to have this persistence.

Concretely, as explained here, when the access token expires after one hour, the SDK uses the refresh token behind the scene to get a new valid set of tokens.

If you have a specific reason to manage this persistence yourself instead of taking advantage of the standard mechanism, please update your question accordingly.



Answered By - Renaud Tarnec
Answer Checked By - - Jay B. (ReactFix Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Post Older Post Home

Featured Post

Is Learning React Difficult?

React is difficult to learn, no ifs and buts. React isn't inherently difficult to learn. It's a framework that's different from ...

Total Pageviews

Copyright © ReactFix