baumblatt / capacitor-firebase-auth

Capacitor Firebase Authentication Plugin
MIT License
261 stars 129 forks source link

Phone Verification failed on modern Android #221

Closed nichealpham closed 2 years ago

nichealpham commented 2 years ago

In modern android, the phone verification is automatically verified when the OTP arrives, so when typing the OTP again the users get a verification code expired error.

This issue only happens in:

  1. Modern Android phone
  2. OTP received on the same Android device that sends the verification request

Possible fix: In another library, there are options for listening to the AuthenticationChangedEvent, we need that event to automatically Login the user when the OTP arrives without requiring the user to type in the code manually.

React-native firebase Auth got the feature: https://rnfirebase.io/auth/phone-auth

Screen Shot 2022-06-12 at 13 24 19
auth().onAuthStateChanged(user => {
        if (user && user.phoneNumber) {
          console.log('>>>>> onAuthStateChanged!! => user', user);
          .....
         }
});
nichealpham commented 2 years ago

Sorry, it was me that not reading the document correctly. The library has efficiently handling this case via the call back

cfaSignInPhone('+16505551234').subscribe(
    user => console.log(user.phoneNumber)
)

So Closing the issue now. Thanks.