Reputation: 173
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?
Upvotes: 1
Views: 1305
Reputation: 7352
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.
Upvotes: 3