React Native Code中的Firebase电话身份验证错误

时间:2020-05-21 06:57:24

标签: firebase react-native firebase-authentication react-native-android react-native-firebase

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

只有在具有DOM支持的浏览器HTTP / HTTPS环境中才支持RecaptchaVerifier

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" 当我删除第二个参数时,它给出一个错误,指出需要两个参数,发现一个

1 个答案:

答案 0 :(得分:0)

您确定使用的是{X.X版本的react-native-firebase电话认证。您可以从方法中跳过批准者,而可以从react-native-firebase中使用以下方法。它将自动打开一个窗口,以验证应用程序和权限。

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