Firebase Phone React Native 代码中的身份验证错误

Firebase Phone Authentication error in React Native Code

我正在尝试构建 React Native 应用程序和 firebase 身份验证。我收到错误:

RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support

auth
      .signInWithPhoneNumber(number, appVerifier)) // <- this is where captcha is added
      .then((result) => {
        this.setState({ confirm: result });
        this.setState({ buttonText: "Verify OTP" });
        this.setState({ isLoading: false });
      })
      .catch((err) => {
        console.log(`Error in phone auth: ${err}`);
      });

我使用的firebase版本是"react-native-firebase": "^5.6.0" 当我删除第二个参数时,它给出了一个错误,指出需要两个参数,找到一个

您确定您使用的是 react-native-firebase phone 身份验证 5.X.X 版本。您可以从方法中跳过应用程序验证程序,而是使用 react-native-firebase 中的以下方法。它会自动打开一个window来验证应用程序并重新验证。

firebase.auth().signInWithPhoneNumber(phoneNumber)
.then(confirmResult => // save confirm result to use with the manual verification code)
.catch(error => /error);