Firebase (Flutter) 验证电话号码始终需要 reCAPTCHA

Posted

技术标签:

【中文标题】Firebase (Flutter) 验证电话号码始终需要 reCAPTCHA【英文标题】:Firebase (Flutter) authenticate phone number always requires reCAPTCHA 【发布时间】:2021-08-03 04:04:15 【问题描述】:

想要的结果

能够在物理 iPhone 上运行的 Flutter 应用上authenticate a user via phone number 而不会看到 reCAPTCHA 屏幕

实际结果

我能够进行身份验证,但每次我都会看到 reCAPTCHA,即使我启用了静默通知

问题总结

我正在尝试将我的 Flutter/Firebase 应用设置为通过 iPhone 上的电话号码进行身份验证。我让它工作,但每次它进行身份验证时,它都使用reCAPTCHA verification 而不是所需的silent notification 进程。在 android Studio 中输出的错误显示在下面的 Console Output 部分

额外信息

我从firebase tutorial 开始,以启动和运行基本的电话身份验证。然后我按照本节在ios平台上enable app verification。那时我开始遇到只能使用 reCAPTCHA 进行验证的问题

我一直在互联网上搜索,似乎有类似的问题,但他们都没有回答这个问题......

AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID ios requires reCAPCHA every time w/ firestore auth (Flutter)

控制台输出

在下面的输出块中,它提到了error:Permission denied portName:'com.apple.iphone.axserver',但我完全不知道com.apple.iphone.axserver 是什么,也不知道要修改什么来解决这个问题。

[AXRuntimeCommon] Unknown client: Runner
7.11.0 - [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: 
    "deep_link_id" = "https://gladly-app.firebaseapp.com/__/auth/callback?authType=verifyApp&recaptchaToken=really long token. if it's required I can add it...";

[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:407 (
    0   AXRuntime                           0x00000001a5aeca9c 4000B9C5-BBB5-3718-8002-F2350DA460F9 + 346780
    1   AXRuntime                           0x00000001a5a9bb58 _AXGetPortFromCache + 548
    2   AXRuntime                           0x00000001a5a9d1a0 AXUIElementPerformFencedActionWithValue + 460
    3   UIKit                               0x00000001d025355c FEF8F17C-E529-34BE-91B9-D492B253DB94 + 853340
    4   libdispatch.dylib                   0x00000001878a32b0 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 393904
    5   libdispatch.dylib                   0x00000001878a4298 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 397976
    6   libdispatch.dylib                   0x000000018788034c 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 250700
    7   libdispatch.dylib                   0x0000000187880e34 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 253492
    8   libdispatch.dylib                   0x000000018788a674 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 292468
    9   libsystem_pthread.dylib             0x00000001cff715bc _pthread_wqthread + 272
    10  libsystem_pthread.dylib             0x00000001cff7486c start_wqthread + 8
)
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:407 (
    0   AXRuntime                           0x00000001a5aeca9c 4000B9C5-BBB5-3718-8002-F2350DA460F9 + 346780
    1   AXRuntime                           0x00000001a5a9bb58 _AXGetPortFromCache + 548
    2   AXRuntime                           0x00000001a5a9d1a0 AXUIElementPerformFencedActionWithValue + 460
    3   UIKit                               0x00000001d025355c FEF8F17C-E529-34BE-91B9-D492B253DB94 + 853340
    4   libdispatch.dylib                   0x00000001878a32b0 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 393904
    5   libdispatch.dylib                   0x00000001878a4298 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 397976
    6   libdispatch.dylib                   0x000000018788034c 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 250700
    7   libdispatch.dylib                   0x0000000187880e34 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 253492
    8   libdispatch.dylib                   0x000000018788a674 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 292468
    9   libsystem_pthread.dylib             0x00000001cff715bc _pthread_wqthread + 272
    10  libsystem_pthread.dylib             0x00000001cff7486c start_wqthread + 8
)
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:407 (
    0   AXRuntime                           0x00000001a5aeca9c 4000B9C5-BBB5-3718-8002-F2350DA460F9 + 346780
    1   AXRuntime                           0x00000001a5a9bb58 _AXGetPortFromCache + 548
    2   AXRuntime                           0x00000001a5a9d1a0 AXUIElementPerformFencedActionWithValue + 460
    3   UIKit                               0x00000001d025355c FEF8F17C-E529-34BE-91B9-D492B253DB94 + 853340
    4   libdispatch.dylib                   0x00000001878a32b0 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 393904
    5   libdispatch.dylib                   0x00000001878a4298 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 397976
    6   libdispatch.dylib                   0x000000018788034c 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 250700
    7   libdispatch.dylib                   0x0000000187880e34 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 253492
    8   libdispatch.dylib                   0x000000018788a674 16C9F613-7AE3-32CE-BA3A-B0DCF0464F0E + 292468
    9   libsystem_pthread.dylib             0x00000001cff715bc _pthread_wqthread + 272
    10  libsystem_pthread.dylib             0x00000001cff7486c start_wqthread + 8
)

【问题讨论】:

声望达到15后可以post an answer to your own question! 【参考方案1】:

原来我所要做的就是将键/值对添加到 this 帖子建议的 info.plist 中

<key>UIBackgroundModes</key>
<array>
    <string>remote-notification</string>
</array>

【讨论】:

以上是关于Firebase (Flutter) 验证电话号码始终需要 reCAPTCHA的主要内容,如果未能解决你的问题,请参考以下文章

使用 Firebase 和 Flutter 通过 OTP 验证电话号码

Flutter + Firebase Auth:有啥方法可以在 Web 上使用 Firebase 电话身份验证重新发送短信验证码?

Flutter bloc 和 Firebase 电话身份验证

Firebase 电话身份验证 (Flutter) 在某些 iOS 设备中不起作用

Flutter Firebase 电话身份验证不起作用

使用 BLoC 进行 Flutter Firebase 电话身份验证