javascript - 在离子电容器 ios 平台中出现错误:仅在浏览器 HTTP/HTTPS 环境中支持 RecaptchaVerifier
问题描述
我正在开发ionic capacitor
具有 Firebase 电话身份验证功能的应用程序。我已遵循 firebase 文档并将代码设置为身份验证电话,并使用 firebase 发送 otp 和验证。它在浏览器和安卓设备上运行良好。我正在获取 otp,我也可以验证它,但现在我正在创建 ios 构建并发现我遇到了一些错误
code: "auth/operation-not-supported-in-this-environment"
message: "RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment."
请在下面找到我的代码
recaptchaVerifier: firebase.auth.RecaptchaVerifier;
ionViewDidLoad() {
this.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', {
size: 'invisible',
callback: (response) => {
},
'expired-callback': () => {
}
});
}
signInWithPhoneNumber() {
this.authService.signInWithPhoneNumber(this.recaptchaVerifier, +19898989898).then(
success => {
this.verifyPhone();
}).catch(error => this.afterLoginError(error));
}
所以问题只在于ios
解决方案
推荐阅读
- reactjs - 使用材料的 ReactJs 倍数复选框
- php - 为什么即使代码正确并且没有出现错误,我也无法将数据输入数据库?
- flutter - WebSocketChannel 在传递给 StatefulWidget 的 State 类时变为 null
- javascript - 对象方法中的Javascript延迟
- javascript - 连接来自多个 fetch JS (RAWG API) 的数据
- deep-learning - 如何缩短神经网络的训练时间,并且仍然获得与真实值相匹配的值(准确度或其他指标)?
- python - 在 Python 中读取和转换 CSV 的自定义日期时间格式
- css - 如何在固定纵横比 16/9 的情况下保持图像 100% 的视口宽度
- node.js - 如何续订 aws iam 角色凭据?
- angular - 我应该如何使用 Ng2 文件上传添加额外的参数?