Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto authentication doesn't trigger onAuthStateChanged() #100

Open
skibaalex opened this issue Jun 18, 2020 · 2 comments
Open

auto authentication doesn't trigger onAuthStateChanged() #100

skibaalex opened this issue Jun 18, 2020 · 2 comments

Comments

@skibaalex
Copy link

skibaalex commented Jun 18, 2020

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'])
}
})`

@skibaalex
Copy link
Author

also tried to run it as a sync function got the same result

@zelony
Copy link

zelony commented Apr 9, 2021

have you solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants