React本机代码中的Firebase电话身份验证错误

问题描述 投票:0回答:1

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

firebase react-native firebase-authentication react-native-android react-native-firebase
1个回答
0
投票

您可以从方法中跳过批准者,而从react-native-firebase中使用以下方法。它将自动打开一个窗口来验证应用程序和权限。

firebase.auth().signInWithPhoneNumber(phoneNumber)
.then(confirmResult => // save confirm result to use with the manual verification code)
.catch(error => /error);
© www.soinside.com 2019 - 2024. All rights reserved.