首页 > 解决方案 > 在离子电容器 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

标签: javascriptfirebasefirebase-authenticationcapacitorionic5

解决方案


推荐阅读