【问题标题】:How to implement firebase phone verification system without using captcha verifier?如何在不使用验证码验证器的情况下实现 Firebase 电话验证系统?
【发布时间】:2020-05-27 15:27:36
【问题描述】:

我已经实现了使用谷歌要求的验证码验证器的 Firebase 默认电话验证,它正在工作,但验证码给出错误“Recaptcha 验证失败 - DUPE”。我想摆脱错误和验证码验证器。

           firebase.initializeApp(firebaseConfig);
           // Create a Recaptcha verifier instance globally
            // Calls submitPhoneNumberAuth() when the captcha is verified
            window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier(
            "recaptcha-container_new",
             {
               size: "normal",
               callback: function(response) {
               submitPhoneNumberAuth();
             }
           }
       );

           function submitPhoneNumberAuth() {
             var phoneNumber = document.getElementById("phoneNumber").value;
             var appVerifier = window.recaptchaVerifier;
             firebase
             .auth()
             .signInWithPhoneNumber(phoneNumber, appVerifier)
             .then(function(result) {
              confirmationResult = result;
               console.log(result);
             })
               .catch(function(error) {
                console.log(error);
              });
            }

【问题讨论】:

    标签: javascript firebase firebase-authentication recaptcha


    【解决方案1】:

    尺寸必须不可见

    firebase.auth.RecaptchaVerifier('recaptcha-container_new', {
      'size': 'invisible'
    });
    

    Angular 7 & Firebase Login with Phone Number (use invisible reCAPTCHA) in Turkish Language

    我希望它有用。

    【讨论】:

    • 是的,我之前做过,实际上问题是这个错误“Recaptcha 验证失败 - DUPE”。它在“正常”或“不可见”两种模式下都会产生错误。有没有办法彻底去除验证码?
    • 您是否在 .html 文件中使用了“recaptcha-container_new”?如<div id="recaptcha-container_new"></div>
    • stackoverflow.com/questions/51185024/… 有什么有用的东西吗?
    • @KamranAli 我不是像 Firebase 那样的机器人,无法使用普通的 fb sdk 添加? fir-ui-demo-84a6c.firebaseapp.com
    • 我是在媒体上分享的。 medium post - PhoneLogin
    猜你喜欢
    • 1970-01-01
    • 2020-03-11
    • 2019-08-29
    • 2021-11-21
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 2018-10-09
    相关资源
    最近更新 更多