代码之家  ›  专栏  ›  技术社区  ›  S.V.

如何正确地创建flatterfire在web上期望的phone auth容器?

  •  0
  • S.V.  · 技术社区  · 4 年前

    我在工作 this documentation of FlutterFire

    我正在尝试在web上实现电话登录。指南似乎建议RecaptchaVerifier是一个可选参数:

    FirebaseAuth auth = FirebaseAuth.instance
    
    // Wait for the user to complete the reCAPTCHA & for a SMS code to be sent.
    ConfirmationResult confirmationResult = await auth.signInWithPhoneNumber('+44 7123 123 456');
    

    enter image description here

    我已经确认我使用的是正确版本的库-- firebase_auth: "^0.18.0+1"

    那么,为了正确显示Recaptcha验证器,我如何在DOM上创建一个具有指定ID的元素呢?

    我找到了 following relevant code 在他们的Github中,它显示了如何访问元素,然而我对源代码的具体理解却一窍不通。

    怎么办?

    0 回复  |  直到 4 年前
        1
  •  1
  •   Mathis Fouques    4 年前

    是的,所以我也经历过同样的问题。这里的问题是文档与PR不同步:更改文档的PR已被合并 但是 你正在使用的插件firebase\u auth尚未更改,因此你仍然拥有旧插件和新文档。。 所以解决办法是:

    firebase_auth: 
        git:
          url: https://github.com/FirebaseExtended/flutterfire
          path: packages/firebase_auth/firebase_auth
          ref: 4a05ceba74c805bc5528137d40c75865cd21d687
    

    以及下面的dependencies\u override,如下所示(如果没有,请添加到dev\u dependencies部分下面):

    dependency_overrides:
      firebase_auth_web:
        git:
          url: https://github.com/FirebaseExtended/flutterfire
          path: packages/firebase_auth/firebase_auth_web
          ref: 4a05ceba74c805bc5528137d40c75865cd21d687
      firebase_auth_platform_interface:
        git:
          url: https://github.com/FirebaseExtended/flutterfire
          path: packages/firebase_auth/firebase_auth_platform_interface
          ref: 4a05ceba74c805bc5528137d40c75865cd21d687
    

    顺便说一句,您需要覆盖依赖项的原因是因为firebase\u auth插件(带有精确提交)仍然使用旧版本的flatterweb插件