【问题标题】:Error using Firebase authentication RecaptchaVerifier in Angular在 Angular 中使用 Firebase 身份验证 RecaptchaVerifier 时出错
【发布时间】:2021-12-26 14:21:44
【问题描述】:

我正在尝试使用 Angular 12 和 Firebase 实现 2FA。但是我在 ngAfterViewInit 的过程开始时不断收到错误:

这是我的代码:

  ngAfterViewInit(): void {
    this.windowRef = this.win.windowRef;
    this.windowRef.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', {
      'size': 'invisible',
      'callback': (response: any) => {
        console.log('callback ==>',response);
      }
    });
    this.windowRef.recaptchaVerifier.render();      
  }

我主要关注this example

【问题讨论】:

    标签: angular firebase firebase-authentication recaptcha


    【解决方案1】:

    问题出在我的 html 中。我有一个 <div id="recaptcha-container"></div> 里面的 if 条件是错误的。我把它从那个 if 条件中移出来了,它工作得很好。

    【讨论】:

      猜你喜欢
      • 2021-12-12
      • 2020-05-20
      • 2021-05-29
      • 2017-02-24
      • 2018-04-15
      • 2020-06-01
      • 1970-01-01
      • 2021-05-24
      • 1970-01-01
      相关资源
      最近更新 更多