firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.71k stars 3.97k forks source link

🐛Firebase_auth Flutter Firebase Phone Authentication error on Android #4322

Closed ufukhawk closed 3 years ago

ufukhawk commented 3 years ago

I want to verify the Phone number with Firebase Auth but it gives the following error,

Notes : My sha1 and sha256 keys are attached. It works when I manually add the phone number to firebase. Works smoothly on iOS devices.

[GetAuthDomainTask] Error getting project config.

{
"error":{
  "code":400,
  "message":"INVALID_CERT_HASH",
  "errors":[
     {
        "message":"INVALID_CERT_HASH",
        "domain":"global",
        "reason":"invalid"
     }
  ]
}
}

output :

I/chatty  (10469): uid=10134(com.xxx.xxx) identical 1 line
W/xxx.xxx(10469): Accessing hidden method Lsun/misc/Unsafe;- 
>putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/System  (10469): Ignoring header X-Firebase-Locale because its value 
was null.
D/EGL_emulation(10469): eglMakeCurrent: 0x7a08b7442b80: ver 3 0 (tinfo 
0x7a08b7299680)
E/FirebaseAuth(10469): [GetAuthDomainTask] Error getting project 
config. Failed with {
E/FirebaseAuth(10469):   "error": {
E/FirebaseAuth(10469):     "code": 400,
E/FirebaseAuth(10469):     "message": "INVALID_CERT_HASH",
E/FirebaseAuth(10469):     "errors": [
E/FirebaseAuth(10469):       {
E/FirebaseAuth(10469):         "message": "INVALID_CERT_HASH",
E/FirebaseAuth(10469):         "domain": "global",
E/FirebaseAuth(10469):         "reason": "invalid"
E/FirebaseAuth(10469):       }
E/FirebaseAuth(10469):     ]
E/FirebaseAuth(10469):   }
E/FirebaseAuth(10469): }
E/FirebaseAuth(10469):  400
E/zzf     (10469): Failed to get reCAPTCHA token - calling backend 
without app verification
D/EGL_emulation(10469): eglMakeCurrent: 0x7a08b7442b80: ver 3 0 (tinfo 
0x7a08b7299680)
W/System  (10469): Ignoring header X-Firebase-Locale because its value 
was null.
E/FirebaseAuth(10469): [SmsRetrieverHelper] SMS verification code 
request failed: unknown status code: 17093 null
I/flutter (10469): exception
I/flutter (10469): [firebase_auth/missing-client-identifier] This 
request is missing a valid app identifier, meaning that neither 
SafetyNet checks nor reCAPTCHA checks succeeded. Please try again, or 
check the logcat for more details.
W/GoogleApiManager(10469): com.google.android.gms.internal.auth-api- 
phone.zzv could not execute call because it requires feature 
(sms_retrieve, 1).
W/GoogleApiAvailability(10469): GMS core API Availability. 
ConnectionResult=2, tag=null
W/GoogleApiAvailability(10469): java.lang.IllegalArgumentException
markusaksli-nc commented 3 years ago

Hi @ufukhawk Could you please provide your flutter doctor -v and flutter pub deps -- --style=compact? Thank you

ufukhawk commented 3 years ago

flutter doctor -v

[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale en-TR)
    • Flutter version 1.22.4 at /Users/xxx/Developer/flutter
    • Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/xxx/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.2, Build version 12B45b
    • CocoaPods version 1.10.0

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin installed
    • Dart plugin version 201.9245
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (1 available)
    • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 10 (API 29) (emulator)

• No issues found!

flutter pub deps -- --style=compact

Changing current working directory to: /Users/xxx/Desktop/xxx-mobil-project/Flutter Project/xxx
Dart SDK 2.10.4
Flutter SDK 1.22.4
xxx 2.5.4+5

dependencies:
- auto_size_text 2.1.0 [flutter]
- cached_network_image 2.3.1 [flutter flutter_cache_manager octo_image]
- checkbox_formfield 0.1.0+3 [flutter]
- color 2.1.1
- connectivity 0.4.9+2 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web]
- cupertino_icons 0.1.3
- date_time_picker 1.0.1 [flutter flutter_localizations intl]
- devicelocale 0.3.2 [flutter]
- expandable_bottom_sheet 0.2.1+1 [flutter]
- firebase_auth 0.18.4 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.5.3 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_messaging 7.0.3 [meta flutter firebase_core]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_chip_tags 1.0.3 [flutter]
- flutter_easyloading 2.1.3 [flutter flutter_spinkit]
- flutter_guid 0.1.0 [flutter uuid validators]
- flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math]
- flutter_multi_chip_select 0.1.1 [flutter]
- flutter_rounded_progress_bar 0.1.2 [flutter]
- flutter_share 1.0.2+1 [flutter]
- flutter_shine 0.0.5 [flutter]
- flutter_sparkline 0.1.0 [flutter]
- fluttertoast 7.0.4 [flutter flutter_web_plugins]
- geolocator 5.3.2+2 [flutter meta equatable google_api_availability location_permissions vector_math]
- google_fonts 1.1.0 [flutter http path_provider crypto pedantic]
- google_maps_flutter 1.0.6 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- groovin_widgets 1.6.0 [flutter]
- http 0.12.2 [http_parser path pedantic]
- image_picker 0.6.7+7 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- jwt_decoder 1.0.3 [flutter]
- mask_text_input_formatter 1.1.0 [flutter]
- material_floating_search_bar 0.1.7 [flutter meta]
- modal_bottom_sheet 0.2.0+1 [flutter]
- ndialog 2.1.2 [flutter simple_animations]
- path_provider 1.6.24 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- rect_getter 0.1.0 [flutter]
- rounded_loading_button 1.0.12 [flutter rxdart]
- share 0.6.5+4 [meta mime flutter]
- shared_preferences 0.5.10 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web]
- simple_animations 2.2.1 [flutter sa_multi_tween sa_anicoto sa_stateless_animation sa_v1_migration]
- solid_bottom_sheet 0.1.9 [flutter]
- stop_watch_timer 0.6.0+1 [flutter rxdart]
- table_calendar 2.2.3 [flutter intl simple_gesture_detector]
- timeago 2.0.27
- timeline_tile 0.1.2 [flutter]
- timer_count_down 1.0.4+1 [flutter]
- transparent_image 1.0.0
- turkish 0.1.0+2
- url_launcher 5.7.2 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows]

dev dependencies:
- flutter_launcher_name 0.0.1 [flutter yaml]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- asn1lib 0.6.5
- async 2.5.0-nullsafety.1 [collection]
- basic_utils 2.6.3 [http logging json_annotation pointycastle asn1lib convert crypto]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- collection 1.15.0-nullsafety.3
- connectivity_for_web 0.3.1+2 [connectivity_platform_interface flutter_web_plugins flutter]
- connectivity_macos 0.1.0+4 [flutter]
- connectivity_platform_interface 1.0.6 [flutter meta plugin_platform_interface]
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- equatable 1.2.4 [collection meta]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase_auth_platform_interface 2.1.4 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.2+2 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 2.1.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+1 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_blurhash 0.5.0 [flutter meta]
- flutter_cache_manager 1.4.1 [flutter path_provider uuid http path sqflite pedantic clock file rxdart]
- flutter_plugin_android_lifecycle 1.0.8 [flutter]
- flutter_spinkit 4.1.2+1 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- google_api_availability 2.0.4 [flutter]
- google_maps_flutter_platform_interface 1.0.4 [flutter meta plugin_platform_interface stream_transform]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image_picker_platform_interface 1.1.0 [flutter meta http plugin_platform_interface]
- intl 0.16.1 [path]
- js 0.6.2
- json_annotation 3.0.1
- location_permissions 3.0.0+1 [flutter meta]
- logging 0.11.4
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- mime 0.9.7
- octo_image 0.2.1 [flutter flutter_blurhash]
- path 1.8.0-nullsafety.1
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+3 [flutter]
- path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.0
- platform 2.2.1
- plugin_platform_interface 1.0.2 [meta]
- pointycastle 1.0.2
- process 3.0.13 [file intl meta path platform]
- quiver 2.1.5 [matcher meta]
- random_string 2.1.0
- rxdart 0.24.1
- sa_anicoto 1.0.2 [flutter supercharged]
- sa_multi_tween 1.1.1 [flutter supercharged]
- sa_stateless_animation 1.0.1 [flutter supercharged sa_anicoto]
- sa_v1_migration 1.1.2 [flutter]
- shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- simple_gesture_detector 0.1.4 [flutter]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sqflite 1.3.1+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- supercharged 1.10.0 [supercharged_dart flutter]
- supercharged_dart 1.2.0
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_linux 0.0.1+1 [flutter]
- url_launcher_macos 0.0.1+8 [flutter]
- url_launcher_platform_interface 1.0.8 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.4+1 [url_launcher_platform_interface flutter flutter_web_plugins meta]
- url_launcher_windows 0.0.1+1 [flutter]
- uuid 2.2.2 [crypto convert]
- validators 2.0.1 [vin_decoder]
- vector_math 2.1.0-nullsafety.3
- vin_decoder 0.1.2 [meta basic_utils http random_string]
- win32 1.7.3 [ffi]
- xdg_directories 0.1.0 [path process flutter]
- yaml 2.2.1 [charcode collection string_scanner source_span]
markusaksli-nc commented 3 years ago

Do you have phone authentication enabled and the SHA certificate fingerprint added to Firebase console?

ufukhawk commented 3 years ago

Do you have phone authentication enabled and the SHA certificate fingerprint added to Firebase console?

Yes I did it all

markusaksli-nc commented 3 years ago

Does this reproduce for you with the official example code? If not could you provide a minimal complete reproducible code sample?

Jainbaba commented 3 years ago

Having the same issue too.

ufukhawk commented 3 years ago

i am solved.

febinmathew commented 3 years ago

i am solved.

Hey! How did you solved it?

asmeretp commented 3 years ago

Yeah @ufukhawk I am having the same issue. How did you solve it?

ufukhawk commented 3 years ago

I solved my problem by creating a sha1 key with debug key info and adding firebase. This was giving the error because I only created the sha1 key with Release Key Info.

Then I activated "Android Device Verification" from console.cloud.google.com and entered the sha keys that firebase automatically added and added the necessary definitions (package names, etc.). And now it works smoothly. I do not get why these topics are never addressed on the Internet and in this library. great deficiency...

asmeretp commented 3 years ago

Thank you so much for your response. I will try to implement that!