每次有Firestore身份验证(Flutter),iOS都需要reCAPCHA

时间:2020-03-19 22:58:45

标签: ios xcode flutter firebase-authentication recaptcha

我在Flutter应用中使用电话验证。我的目标是建立以下流程:1.用户输入电话号码2.向用户发送验证码3.用户输入代码并登录。在android上,这就是我得到的流程。但是,在ios上,它变为1.用户输入电话号码。2. reCAPCHA页面打开,以确保我不是机器人。3.向用户发送了验证码。4.用户输入了代码并登录(这在ios模拟器上发生) 。我想摆脱reCAPCHA页面。有人建议我打开“远程通知”,因此我尝试在Xcode中通过将其作为“功能”添加到跑步者中来进行此操作,现在我的Info.plist包括了

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

哪个似乎正确。但是,这并不能解决问题,我仍然面临着问题。

firebase auth的版本:

firebase_auth: 0.15.4

扑动医生的输出

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-US)
    • Flutter version 1.12.13+hotfix.5 at /Users/gollyzoom/development/flutter
    • Framework revision 27321ebbad (3 months ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/gollyzoom/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 39.0.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.4)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 38.1.3
    • Dart plugin version 191.8593

[✓] Connected device (2 available)
    • Android SDK built for x86 • emulator-5554                        • android-x86 • Android 9 (API 28) (emulator)
    • iPhone 11 Pro Max         • B3536B50-C435-4442-9CF4-69D470B979CA • ios         •
      com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

• No issues found!

如果有人对此提出建议,我将非常感谢!

3 个答案:

答案 0 :(得分:1)

这也恰好在Android中。输入验证码之前,我会打开reCaptcha。

答案 1 :(得分:0)

您将需要为iOS设置静默推送通知。

参考本文档:https://firebase.google.com/docs/auth/ios/phone-auth

授权电话号码时,您会看到两种策略:reCaptcha(验证您不是机器人)和无提示推送通知。

还有其他配置,但摘要:

  1. 在Xcode中,为您的项目启用推送通知。
  2. 将您的APNs身份验证密钥上载到Firebase。

答案 2 :(得分:0)

这是我在Android https://github.com/FirebaseExtended/flutterfire/issues/4189#issuecomment-741711350中遇到的问题的解决方案

@Omrankabalan采取的步骤

转到https://console.cloud.google.com/

如果您有Firebase项目,则可以从此处打开

enter image description here

然后选择“全部”标签,然后选择您现有的项目

enter image description here

然后转到API和服务=>库 搜索“ Android设备验证”

enter image description here

启用

enter image description here

在Firebase中,确保在项目设置中添加SHA-256

enter image description here enter image description here

在真实设备上进行测试