0
votes

I am beginner in React Native. I am developing an app right now and implementing phone number based authentication using Firebase.

As per the Firebase docs, I have implemented the code changes in my login form.

onButtonPress(){
    const{pnum} = this.state;
    var appVerifier = new firebase.auth.RecaptchaVerifier('phonerecaptcha', {
      'size': 'invisible',
      'callback': function(response) {
        // reCAPTCHA solved - will proceed with submit function
        onSignInSubmit();
      }
    });//window.recaptchaVerifier;
    firebase.auth().signInWithPhoneNumber(pnum,appVerifier)
    .then(function (confirmationResult) {
      this.confirmationResult = confirmationResult;
    }).catch(function (error) {

    })
  }

This is the error I am getting in the console when I submit and send a request to Firebase.

Can't find variable: document wc E:\reactNative\prithivi\thala\node_modules\@firebase\auth\dist\auth.js:28:644 Ul E:\reactNative\prithivi\thala\node_modules\@firebase\auth\dist\auth.js:269:784 hm E:\reactNative\prithivi\thala\node_modules\@firebase\auth\dist\auth.js:277:402 d E:\reactNative\prithivi\thala\node_modules\@firebase\auth\dist\auth.js:277:702

Unable to find any pointers to resolve this issue.

1

1 Answers

0
votes

reCAPTCHA is not supported in react-native. Currently phone authentication is only supported in browser environments. To build your own workaround, follow this recommendation: Using Firebase Phone number Auth with react-native