https://firebase.google.com/docs/auth/web/auth-state-persistence
The default for web browser and React Native apps is local (provided the browser supports this storage mechanism, eg. 3rd party cookies/data are enabled) whereas it is none for Node.js backend apps.
When I try the following in my React Native Android app:
const signIn = () =>
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL).then(() => {
return firebase.auth().signInAnonymously();
});
I get the following error:
The current environment does not support the specified persistence type.
Is this a bug or have I missed something from the docs?
Environment:
"dependencies": {
"firebase": "^4.5.0",
"react": "16.0.0-alpha.12",
"react-native": "^0.48.4",
}
Android 7.0
Seems there's a bug in selectively importing firebase modules.
Changing the imports from
import * as firebase from 'firebase/app';
import 'firebase/auth';
to
import firebase from 'firebase';
solved the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With