cordova-plugin-firebase-authentication
cordova-plugin-firebase-authentication copied to clipboard
auto authentication doesn't trigger onAuthStateChanged()
tried to both solutions i found in here.
`his.auth.verifyPhoneNumber(phoneNumber, 120000).then(async verificationId => { if(verificationId){ loading.dismiss() const alert = await this.alertCtrl.create({ header: 'Verify phone number', message: 'Please provide the SMS code you received on your phone.', inputs: [ { name: 'code', type: 'tel', placeholder: 'SMS Code' }, ], buttons: [ { text: 'Cancel', role: 'cancel', cssClass: 'secondary',
handler: (blah) => {
console.log('Confirm Cancel: blah');
}
}, {
text: 'Okay',
handler: (data) => {
loading.present()
this.auth.signInWithVerificationId(verificationId, data.code).then(async res => {
console.log(res);
this.toast.show('Signed in')
this.router.navigate(['home'])
})
}
}
]
});
await alert.present();
} else {
await loading.dismiss()
this.router.navigate(['home', 'menu'])
}
this.auth.onAuthStateChanged().subscribe(user => { if(user){ this.user.next(user) this.router.navigate(['home', 'menu']) } else{ this.user.next(null) this.router.navigate(['login']) } })`
also tried to run it as a sync function got the same result
have you solved it?