问题描述
我在Flutter应用中使用电话验证.我的目标是建立以下流程:1.用户输入电话号码2.向用户发送验证码3.用户输入代码并登录.在android上,这就是我得到的流程.但是,在ios上,它变为1.用户输入电话号码.2. reCAPCHA页面打开,以确保我不是机器人.3.向用户发送了验证码.4.用户输入了代码并登录(这是在ios模拟器上发生的).我想摆脱reCAPCHA页面.有人建议我打开远程通知",因此我尝试在Xcode中通过将其作为功能"添加到我的跑步者中来做到这一点,现在我的Info.plist包括了
< key> UIBackgroundModes</key>< array>< string>远程通知</string></array>
这似乎是对的.但是,这并不能解决问题,而且我仍然面临着问题.
firebase身份验证的版本:
firebase_auth:0.15.4
扑动医生的输出
[✓] Flutter(频道稳定,v1.12.13 + hotfix.5,在Mac OS X 10.15.2 19C57上,语言环境为美国)•位于/Users/gollyzoom/development/flutter的Flutter版本1.12.13 + hotfix.5•Framework版本27321ebbad(3个月前),2019-12-10 18:15:01 -0800•发动机版本2994f7e1e6•Dart 2.7.0版[✓] Android工具链-为Android设备开发(Android SDK版本28.0.3)•位于/Users/gollyzoom/Library/Android/sdk的Android SDK•未配置Android NDK位置(可选;对本机性能分析支持很有用)•平台android-29,构建工具28.0.3•Java二进制文件,位于:/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java•Java版本OpenJDK运行时环境(内部版本1.8.0_202-发行-1483-b49-5587405)•接受所有Android许可.[✓] Xcode-为iOS和macOS开发(Xcode 11.3)•Xcode位于/Applications/Xcode.app/Contents/Developer•Xcode 11.3,内部版本11C29•CocoaPods版本1.8.4[✓] Android Studio(版本3.5)•位于/Applications/Android Studio.app/Contents的Android Studio•Flutter插件版本39.0.3•Dart插件版本191.8423•Java版本OpenJDK运行时环境(内部版本1.8.0_202-发行-1483-b49-5587405)[✓] IntelliJ IDEA Ultimate Edition(版本2019.1.4)•/Applications/IntelliJ IDEA.app中的IntelliJ•Flutter插件版本38.1.3•Dart插件版本191.8593[✓]已连接的设备(2个可用)•为x86构建的Android SDK•仿真器-5554•android-x86•Android 9(API 28)(仿真器)•iPhone 11 Pro Max•B3536B50-C435-4442-9CF4-69D470B979CA•iOS•com.apple.CoreSimulator.SimRuntime.iOS-13-3(模拟器)•找不到问题!
如果有人对此提出建议,我将不胜感激!
以下是我在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 => LibrarySearch for 'Android Device Verification'
Enable it
In Firebase make sure to add SHA-256 In Project Settings
Test it on a real device
这篇关于ios每当有Firestore身份验证(Flutter)时,都需要reCAPCHA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!