I need some help I'm using firebase to register and login to my app, but every time I close the app, it asks me to sign in again when I open ... How do I log in until the user clicks the exit button?
I saw that the firebase has a method for this
firebase.auth.Auth.Persistence.LOCAL
but I do not know how to use
My login method is this
signInUser(){
this.fire.auth.signInWithEmailAndPassword(this.user.value, this.password.value)
.then(data => {
console.log('got some data ', this.fire.auth.currentUser);
this.alert('Parabéns! Você está na sua conta!')
this.navCtrl.setRoot("PrincipalPage")
})
.catch(error => {
console.log('got an error ', error);
this.alert('Username ou senha inválido!')
});
console.log(this.user.value, this.password.value)
}
and in the app.component it looks like this:
export class MyApp {
rootPage:string = "HomePage";
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
});
}
}