Home > Back-end >  Error TypeError: undefined is not an object (evaluating 'verifier.verify')
Error TypeError: undefined is not an object (evaluating 'verifier.verify')

Time:04-13

After I click my touchableopacity I created in react native the button redirects to this function below, and when executed the function returns an error stating Error TypeError: undefined is not an object (evaluating 'verifier.verify') I don't understand why I am receiving this problem as I copied the code from the Firebase website https://firebase.google.com/docs/auth/web/phone-auth?authuser=0&hl=en#set-up-the-recaptcha-verifier. Thank you in advance for any answers!

function phoneSignIn(phoneNumber, navigation){
  // phoneNumber is a string ex:  11111111
  let appVerifier = window.recaptchaVerifier;
  signInWithPhoneNumber(auth, phoneNumber, appVerifier)
  .then((confirmationResult) => {
    window.confirmationResult = confirmationResult;
    navigation.navigate('Verification Code');
  }).catch((error) => {
    console.log("Error "   error);
    //returning error here
  });
}

CodePudding user response:

Looks like you are using the Firebase Web SDK for react native, instead you should use a plugin for react native. Check this plugin for instance

CodePudding user response:

I realized from Tanays answer that I was using web instead of react native for firebase auth connections. Instead I found an expo snack https://snack.expo.dev/@feupp/firebase-phone-auth where I managed to get the auth working from react native!

  • Related