React Native Firebase – signInWithPhoneNumber not returning confirmationResult

I'm using react-native-firebase for phone auth from firebase.

I'm following the documentation from https://rnfirebase.io/auth/phone-auth and I'm not getting anything from the promise

 // Handle the button press
  async function signInWithPhoneNumber(phoneNumber) {
    const confirmation = await auth().signInWithPhoneNumber(phoneNumber);
    setConfirm(confirmation);
  }
 

I tried expanding it to the below, but still the breakpoint is not being hit in then or catch

async function signInWithPhoneNumber() {
      await auth()
        .signInWithPhoneNumber('+0000000000')
        .then(confirmationResult => {
          // Unreachable point / not able to get a confirmationResult after resolving the promise. 
          console.log('confirmation result');
          console.log(`confirmation= ${confirmationResult}`);
          alert('confirmation result');
          setConfirm(confirmationResult);
        })
        .catch(error => {
          // Error; SMS not sent
          // ...
          console.log(`sms not sent= ${error}`);
          alert('confirmation ERR');
        });
    }

All firebase console setup/gradle is fine, I'm getting an sms from firebase with the security code. Since the resolver object is not received, unable to verify the code from client end.

Any help is appreciated.



Read more here: https://stackoverflow.com/questions/68467815/react-native-firebase-signinwithphonenumber-not-returning-confirmationresult

Content Attribution

This content was originally published by nullUser at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: