且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ios每当有Firestore身份验证(Flutter)时,都需要reCAPCHA

更新时间:2023-12-06 09:05:16

以下是我在Android中遇到的问题的解决方案

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

然后转到API&服务=>图书馆搜索"Android设备验证"

启用

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

在真实设备上进行测试

I am using phone verification in my flutter app. My goal is to have the following flow: 1. user enters phone number 2. user is sent verification code 3. user enters code and is signed in. On android, that is the flow I get. On ios, however, it goes 1. user enters phone number 2. reCAPCHA page opens to make sure I'm not a robot 3. user is sent verification code 4. user enters code and is signed in (this happens on ios emulator). I want to get rid of the reCAPCHA page. Some people recommended that I turn on "remote-notifications", so I tried to do this in Xcode by adding it as a "capability" to my runner, and now my Info.plist includes

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

Which seems right. However, this did not fix the issue, and I am still faced with the capcha.

Version of firebase auth:

firebase_auth: 0.15.4

Output of flutter doctor

[✓] 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!

I would really appreciate if anyone had some advice on this!

Here is the solution for my problem in Android https://github.com/FirebaseExtended/flutterfire/issues/4189#issuecomment-741711350

Steps made by @Omrankabalan

Go to https://console.cloud.google.com/

If you have a Firebase project you can open in from here

Then select All tab and choose your existing project

Then go to API & Services => Library Search for 'Android Device Verification'

Enable it

In Firebase make sure to add SHA-256 In Project Settings

Test it on a real device