firebase - React Native 代码中的 Firebase 电话身份验证错误
问题描述
我正在尝试构建一个 React Native 应用程序和 firebase 身份验证。我收到错误:
RecaptchaVerifier 仅在支持 DOM 的浏览器 HTTP/HTTPS 环境中受支持
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
5.XX 版本的电话身份验证。您可以从方法中跳过 appverifier,而是使用react-native-firebase
. 它将自动打开一个窗口来验证应用程序和 recaptha。
firebase.auth().signInWithPhoneNumber(phoneNumber)
.then(confirmResult => // save confirm result to use with the manual verification code)
.catch(error => /error);
推荐阅读
- angularjs - Angular:翻译功能无法从其他组件访问
- fullcalendar - 如何在 FullCalendar v4 中通过 CTRL + 拖放复制事件?
- sockets - 如何在 nasm 中使用 recvfrom 获取 UDP 数据包的源 IP 地址?
- jquery - Jquery 日期时间选择器只有在单击日历图像时才能打开
- javascript - 将变量从一个函数传递到另一个函数 - Javascript
- bash - bash:用源加载的变量不能用于算术运算
- javascript - 如何插入边框底部以跨越 Ooxml?
- java - 不使用 SimpleDateFormat 将日期字符串转换为另一个日期字符串的最有效方法
- mqtt - 无法通过 MQTT 向 ThingsBoard 网关发送数据
- python-3.x - 连接两个 float64 列而不在 python 中转换为 str 的最佳方法是什么?