I'm using Firebase email + pw sign in for my React Native application, but the login doesn't seem to persist after the app is closed and reopened. I read in the documentation that the default is to persist, so I'm not sure why it's not behaving that way?
I'm using the following on componentWillMount:
this.state.dbh.auth().onAuthStateChanged(function(user) {
if (user) {
this.state = {
user: user
}
}
I'm also using Expo to develop - would this have an effect on persisting the login?
This is a regression introduced in Firebase v4.5.1 as described here .
Solution:
npm start -- --reset-cache
Edit:
The issue is fixed in Firebase v4.5.2 .
Change Firebase import
// from import * as firebase from 'firebase/app'; import 'firebase/auth'; // to import firebase from 'firebase';
As described here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.