React-native-firebase: verifyPhoneNumber - phoneAuthSnapshot with null values

Created on 3 Jan 2018  路  2Comments  路  Source: invertase/react-native-firebase

Only tested on Android, but following the example code (https://rnfirebase.io/docs/v3.2.x/auth/phone-auth#Example),

phoneAuthSnapshot returns null values, except for status which returns verified.

Is this related to the fact that I only received the first sms and then wasn't able to receive anymore?

Authentication

All 2 comments

@lslima91 This is expected. When Android auto-verifies, sometimes the verificationId can be null. If you follow the example and build the Phone auth credential as normal, then we handle this for you on the native side to ensure that the user will still be logged in / registered / linked.

@lslima91 How did you make it work? firebase.auth().verifyPhoneNumber is not working for me. I checked the Firebase docs, these functions and classes are not there. For Web, they suggest using RecaptchaVerifier which I fail to understand how can I do for React-native:

var applicationVerifier = firebase.auth.RecaptchaVerifier.('recaptcha-container');

var provider = firebase.auth.PhoneAuthProvider();

provider.verifyPhoneNumber(phoneNumber)

provider.verifyPhoneNumber(phoneNumber, applicationVerifier)
.then(function(verificationId) {
  var verificationCode = window.prompt('Please enter the verification ' +
      'code that was sent to your mobile device.');
  return firebase.auth.PhoneAuthProvider.credential(verificationId,
      verificationCode);
})
.then(function(phoneCredential) {
  return firebase.auth().signInWithCredential(phoneCredential);
});

Also requesting @Salakar (Original contributor to phone-auh example) if he can help to resolve this issue. Many thanks in advance.

Was this page helpful?
0 / 5 - 0 ratings