firebase / FirebaseUI-Flutter

Apache License 2.0
92 stars 79 forks source link

Always go to live Auth server in Android #254

Closed cupidchan closed 5 months ago

cupidchan commented 5 months ago

Is there an existing issue for this?

What plugin is this bug for?

Firebase UI OAuth Google

What platform(s) does this bug affect?

Android

List of dependencies used.

flutter pub deps -s list
Dart SDK 3.2.3
Flutter SDK 3.16.5
firebase_ui_auth_example 1.0.0+1

dependencies:
- cupertino_icons 1.0.6
- firebase_auth 4.16.0
  - firebase_auth_platform_interface ^7.0.9
  - firebase_auth_web ^5.8.13
  - firebase_core ^2.24.2
  - firebase_core_platform_interface ^5.0.0
  - flutter any
  - meta ^1.8.0
- firebase_core 2.24.2
  - firebase_core_platform_interface ^5.0.0
  - firebase_core_web ^2.10.0
  - flutter any
  - meta ^1.8.0
- flutter 0.0.0
  - characters 1.3.0
  - collection 1.18.0
  - material_color_utilities 0.5.0
  - meta 1.10.0
  - vector_math 2.1.4
  - web 0.3.0
  - sky_engine any
- flutter_localizations 0.0.0
  - flutter any
  - intl 0.18.1
  - characters 1.3.0
  - clock 1.1.1
  - collection 1.18.0
  - material_color_utilities 0.5.0
  - meta 1.10.0
  - path 1.8.3
  - vector_math 2.1.4
  - web 0.3.0
- firebase_ui_auth 1.12.1
  - email_validator ^2.1.17
  - firebase_auth ^4.15.3
  - firebase_core ^2.24.2
  - firebase_dynamic_links ^5.4.8
  - firebase_ui_localizations ^1.10.1
  - firebase_ui_oauth ^1.4.17
  - firebase_ui_shared ^1.4.1
  - flutter any
  - flutter_localizations any
  - meta ^1.10.0
- firebase_ui_localizations 1.10.1
  - flutter any
  - flutter_localizations any
  - path ^1.8.3
- firebase_ui_oauth 1.4.17
  - desktop_webview_auth ^0.0.14
  - firebase_auth ^4.15.3
  - firebase_ui_auth ^1.12.1
  - firebase_ui_shared ^1.4.1
  - flutter_svg ^2.0.9
  - flutter any
- firebase_ui_oauth_apple 1.2.17
  - firebase_auth ^4.15.3
  - firebase_ui_oauth ^1.4.17
  - flutter any
- firebase_ui_oauth_facebook 1.2.17
  - firebase_auth ^4.15.3
  - firebase_ui_oauth ^1.4.17
  - flutter any
  - flutter_facebook_auth ^6.0.3
- firebase_ui_oauth_google 1.2.17
  - firebase_auth ^4.15.3
  - firebase_ui_oauth ^1.4.17
  - flutter any
  - google_sign_in ^6.2.1
- firebase_ui_oauth_twitter 1.2.17
  - flutter any
  - firebase_auth ^4.15.3
  - firebase_ui_oauth ^1.4.17
  - twitter_login ^4.4.2

dev dependencies:
- drive 1.0.0-1.0.nullsafety.5
  - test_api any
  - flutter_test any
  - flutter_driver any
  - stack_trace ^1.9.3
  - flutter any
- firebase_ui_shared 1.4.1
  - flutter any
- flutter_facebook_auth 6.0.3
  - flutter any
  - flutter_facebook_auth_platform_interface ^5.0.0
  - flutter_facebook_auth_web ^5.0.0
  - facebook_auth_desktop ^1.0.2
- flutter_driver 0.0.0
  - file 6.1.4
  - flutter any
  - flutter_test any
  - fuchsia_remote_debug_protocol any
  - path 1.8.3
  - meta 1.10.0
  - vm_service 11.10.0
  - webdriver 3.0.2
  - async 2.11.0
  - boolean_selector 2.1.1
  - characters 1.3.0
  - clock 1.1.1
  - collection 1.18.0
  - matcher 0.12.16
  - material_color_utilities 0.5.0
  - platform 3.1.2
  - process 4.2.4
  - source_span 1.10.0
  - stack_trace 1.11.1
  - stream_channel 2.1.2
  - string_scanner 1.2.0
  - sync_http 0.3.1
  - term_glyph 1.2.1
  - test_api 0.6.1
  - vector_math 2.1.4
  - web 0.3.0
- flutter_test 0.0.0
  - flutter any
  - test_api 0.6.1
  - matcher 0.12.16
  - path 1.8.3
  - fake_async 1.3.1
  - clock 1.1.1
  - stack_trace 1.11.1
  - vector_math 2.1.4
  - async 2.11.0
  - boolean_selector 2.1.1
  - characters 1.3.0
  - collection 1.18.0
  - material_color_utilities 0.5.0
  - meta 1.10.0
  - source_span 1.10.0
  - stream_channel 2.1.2
  - string_scanner 1.2.0
  - term_glyph 1.2.1
  - web 0.3.0
- flutter_lints 3.0.1
  - lints ^3.0.0
- google_sign_in 6.2.1
  - flutter any
  - google_sign_in_android ^6.1.0
  - google_sign_in_ios ^5.7.0
  - google_sign_in_platform_interface ^2.4.0
  - google_sign_in_web ^0.12.0
- http 1.1.2
  - async ^2.5.0
  - http_parser ^4.0.0
  - meta ^1.3.0
  - web >=0.3.0 <0.5.0
- integration_test 0.0.0
  - flutter any
  - flutter_driver any
  - flutter_test any
  - path 1.8.3
  - vm_service 11.10.0
  - async 2.11.0
  - boolean_selector 2.1.1
  - characters 1.3.0
  - clock 1.1.1
  - collection 1.18.0
  - fake_async 1.3.1
  - file 6.1.4
  - matcher 0.12.16
  - material_color_utilities 0.5.0
  - meta 1.10.0
  - source_span 1.10.0
  - stack_trace 1.11.1
  - stream_channel 2.1.2
  - string_scanner 1.2.0
  - sync_http 0.3.1
  - term_glyph 1.2.1
  - test_api 0.6.1
  - vector_math 2.1.4
  - web 0.3.0
  - webdriver 3.0.2
- twitter_login 4.4.2
  - crypto ^3.0.1
  - flutter any
  - http ^1.0.0

transitive dependencies:
- _flutterfire_internals 1.3.16
  - collection ^1.0.0
  - firebase_core ^2.24.2
  - firebase_core_platform_interface ^5.0.0
  - flutter any
  - meta ^1.8.0
- args 2.4.2
- async 2.11.0
  - collection ^1.15.0
  - meta ^1.1.7
- boolean_selector 2.1.1
  - source_span ^1.8.0
  - string_scanner ^1.1.0
- characters 1.3.0
- clock 1.1.1
- collection 1.18.0
- crypto 3.0.3
  - typed_data ^1.3.0
- desktop_webview_auth 0.0.14
  - crypto ^3.0.3
  - flutter any
  - http ^1.0.0
  - flutter_web_plugins any
  - plugin_platform_interface ^2.1.4
- email_validator 2.1.17
- facebook_auth_desktop 1.0.2
  - flutter any
  - http ^1.0.0
  - flutter_secure_storage ^9.0.0
  - flutter_facebook_auth_platform_interface ^5.0.0
- fake_async 1.3.1
  - clock ^1.1.0
  - collection ^1.15.0
- ffi 2.1.0
- file 6.1.4
  - meta ^1.3.0
  - path ^1.8.0
- firebase_auth_platform_interface 7.0.9
  - _flutterfire_internals ^1.3.16
  - collection ^1.16.0
  - firebase_core ^2.24.2
  - flutter any
  - meta ^1.8.0
  - plugin_platform_interface ^2.1.3
- firebase_auth_web 5.8.13
  - firebase_auth_platform_interface ^7.0.9
  - firebase_core ^2.24.2
  - firebase_core_web ^2.10.0
  - flutter any
  - flutter_web_plugins any
  - http_parser ^4.0.0
  - js ^0.6.3
  - meta ^1.8.0
- firebase_core_platform_interface 5.0.0
  - collection ^1.0.0
  - flutter any
  - flutter_test any
  - meta ^1.8.0
  - plugin_platform_interface ^2.1.3
- firebase_core_web 2.10.0
  - firebase_core_platform_interface ^5.0.0
  - flutter any
  - flutter_web_plugins any
  - js ^0.6.3
  - meta ^1.8.0
- firebase_dynamic_links 5.4.8
  - firebase_core ^2.24.2
  - firebase_core_platform_interface ^5.0.0
  - firebase_dynamic_links_platform_interface ^0.2.6+16
  - flutter any
  - meta ^1.8.0
  - plugin_platform_interface ^2.1.3
- firebase_dynamic_links_platform_interface 0.2.6+16
  - _flutterfire_internals ^1.3.16
  - firebase_core ^2.24.2
  - flutter any
  - meta ^1.8.0
  - plugin_platform_interface ^2.1.3
- flutter_facebook_auth_platform_interface 5.0.0
  - flutter any
  - plugin_platform_interface ^2.1.4
- flutter_facebook_auth_web 5.0.0
  - flutter any
  - flutter_web_plugins any
  - js ^0.6.3
  - flutter_facebook_auth_platform_interface ^5.0.0
- flutter_secure_storage 9.0.0
  - flutter any
  - flutter_secure_storage_linux ^1.1.3
  - flutter_secure_storage_macos ^3.0.0
  - flutter_secure_storage_platform_interface ^1.0.1
  - flutter_secure_storage_web ^1.1.1
  - flutter_secure_storage_windows ^3.0.0
  - meta ^1.3.0
- flutter_secure_storage_linux 1.2.0
  - flutter any
  - flutter_secure_storage_platform_interface ^1.0.1
- flutter_secure_storage_macos 3.0.1
  - flutter any
  - flutter_secure_storage_platform_interface ^1.0.1
- flutter_secure_storage_platform_interface 1.0.2
  - flutter any
  - plugin_platform_interface ^2.0.1
- flutter_secure_storage_web 1.1.2
  - flutter any
  - flutter_secure_storage_platform_interface ^1.0.1
  - flutter_web_plugins any
  - js ^0.6.3
- flutter_secure_storage_windows 3.0.0
  - ffi ^2.0.0
  - flutter any
  - flutter_secure_storage_platform_interface ^1.0.1
  - path ^1.8.0
  - path_provider ^2.0.0
  - win32 ^5.0.0
- flutter_svg 2.0.9
  - flutter any
  - vector_graphics ^1.1.9+1
  - vector_graphics_codec ^1.1.9+1
  - vector_graphics_compiler ^1.1.9+1
- flutter_web_plugins 0.0.0
  - flutter any
  - characters 1.3.0
  - collection 1.18.0
  - material_color_utilities 0.5.0
  - meta 1.10.0
  - vector_math 2.1.4
  - web 0.3.0
- fuchsia_remote_debug_protocol 0.0.0
  - process 4.2.4
  - vm_service 11.10.0
  - file 6.1.4
  - meta 1.10.0
  - path 1.8.3
  - platform 3.1.2
- google_identity_services_web 0.3.0+2
  - meta ^1.3.0
  - web >=0.3.0 <0.5.0
- google_sign_in_android 6.1.21
  - flutter any
  - google_sign_in_platform_interface ^2.2.0
- google_sign_in_ios 5.7.2
  - flutter any
  - google_sign_in_platform_interface ^2.2.0
- google_sign_in_platform_interface 2.4.5
  - flutter any
  - plugin_platform_interface ^2.1.7
- google_sign_in_web 0.12.3+2
  - flutter any
  - flutter_web_plugins any
  - google_identity_services_web ^0.3.0
  - google_sign_in_platform_interface ^2.4.0
  - http >=0.13.0 <2.0.0
  - web >=0.3.0 <0.5.0
- http_parser 4.0.2
  - collection ^1.15.0
  - source_span ^1.8.0
  - string_scanner ^1.1.0
  - typed_data ^1.3.0
- intl 0.18.1
  - clock ^1.1.0
  - meta ^1.0.2
  - path ^1.8.0
- js 0.6.7
  - meta ^1.7.0
- lints 3.0.0
- matcher 0.12.16
  - async ^2.10.0
  - meta ^1.8.0
  - stack_trace ^1.10.0
  - term_glyph ^1.2.0
  - test_api >=0.5.0 <0.7.0
- material_color_utilities 0.5.0
  - collection ^1.15.0
- meta 1.10.0
- path 1.8.3
- path_parsing 1.0.1
  - vector_math ^2.1.0
  - meta ^1.3.0
- path_provider 2.1.2
  - flutter any
  - path_provider_android ^2.1.0
  - path_provider_foundation ^2.3.0
  - path_provider_linux ^2.2.0
  - path_provider_platform_interface ^2.1.0
  - path_provider_windows ^2.2.0
- path_provider_android 2.2.2
  - flutter any
  - path_provider_platform_interface ^2.1.0
- path_provider_foundation 2.3.1
  - flutter any
  - path_provider_platform_interface ^2.1.0
- path_provider_linux 2.2.1
  - ffi >=1.1.2 <3.0.0
  - flutter any
  - path ^1.8.0
  - path_provider_platform_interface ^2.1.0
  - xdg_directories >=0.2.0 <2.0.0
- path_provider_platform_interface 2.1.2
  - flutter any
  - platform ^3.0.0
  - plugin_platform_interface ^2.1.7
- path_provider_windows 2.2.1
  - ffi ^2.0.0
  - flutter any
  - path ^1.8.0
  - path_provider_platform_interface ^2.1.0
  - win32 >=2.1.0 <6.0.0
- petitparser 6.0.2
  - meta ^1.9.0
- platform 3.1.2
- plugin_platform_interface 2.1.8
  - meta ^1.3.0
- process 4.2.4
  - file ^6.0.0
  - path ^1.8.0
  - platform ^3.0.0
- sky_engine 0.0.99
- source_span 1.10.0
  - collection ^1.15.0
  - path ^1.8.0
  - term_glyph ^1.2.0
- stack_trace 1.11.1
  - path ^1.8.0
- stream_channel 2.1.2
  - async ^2.5.0
- string_scanner 1.2.0
  - source_span ^1.8.0
- sync_http 0.3.1
- term_glyph 1.2.1
- test_api 0.6.1
  - async ^2.5.0
  - boolean_selector ^2.1.0
  - collection ^1.15.0
  - meta ^1.3.0
  - source_span ^1.8.0
  - stack_trace ^1.10.0
  - stream_channel ^2.1.0
  - string_scanner ^1.1.0
  - term_glyph ^1.2.0
- typed_data 1.3.2
  - collection ^1.15.0
- vector_graphics 1.1.9+2
  - flutter any
  - vector_graphics_codec 1.1.9+2
- vector_graphics_codec 1.1.9+2
- vector_graphics_compiler 1.1.9+2
  - args ^2.3.0
  - meta ^1.7.0
  - path_parsing ^1.0.1
  - xml ^6.3.0
  - vector_graphics_codec 1.1.9+2
  - path ^1.8.0
- vector_math 2.1.4
- vm_service 11.10.0
- web 0.3.0
- webdriver 3.0.2
  - matcher ^0.12.10
  - path ^1.8.0
  - stack_trace ^1.10.0
  - sync_http ^0.3.0
- win32 5.2.0
  - ffi ^2.1.0
- xdg_directories 1.0.4
  - meta ^1.3.0
  - path ^1.8.0
- xml 6.5.0
  - collection ^1.18.0
  - meta ^1.9.0
  - petitparser ^6.0.0

Steps to reproduce

1) Start up Firebase Auth Emulator 2) Load the FlutterFire Auth Sample app from FirebaseUI-Flutter/packages/firebase_ui_auth/example 3) Run the app in Android Emulator 4) Click on "Sign in with Google"

Expected Behavior

It should connect to the Local emulator

Actual Behavior

It connects to the live firebase_ui_example Firebase Auth server

Additional Information

  1. There is a line in main.dart await FirebaseAuth.instance.useAuthEmulator('localhost', 9099);
  2. If I start this in Web instead of Android, it points to the local Firebase Emulator without issue
  3. I see a line in the log Mapping Auth Emulator host "localhost" to "10.0.2.2" So, the app should be able to connect to the local machine using the loopback 10.0.2.2
  4. I also tried to explicitly set the line to await FirebaseAuth.instance.useAuthEmulator('10.0.2.2', 9099); but received the same result
  5. I tried to put some wrong IP and the result is the same. That makes me think for some reason the app cannot connect to the local Firebase emulator.
  6. If I use the web browser inside the Android emulator, I can connect successfully the Firebase emulator page. That means the Android emulator can communicate with the local machine without blocking by any Firewall setting
danagbemava-nc commented 5 months ago

Hi @cupidchan, do you also have this issue if you run the firebase_auth example itself and not the firebase_ui_auth example?

cupidchan commented 5 months ago

Hello @danagbemava-nc I just loaded the firebase_auth example as you suggested and change line 19 to bool shouldUseFirebaseEmulator = true; However this is even worse than the firebase_ui_auth example because not only Android, even Web points to the live auth server instead of the local emulator. Can you please see if you observe the same behavior, or it's just me having the issue?

cupidchan commented 5 months ago

And when I continue the sign in process in Android, I got the PlatformException

image
lesnitsky commented 5 months ago

@cupidchan could you please make sure you've added an SHA fingerprint of your Android emulator to the Firebase project? This is very often the reason for ApiException: 10. https://support.google.com/firebase/answer/9137403?hl=en

Also, firebase UI auth example definitely uses emulator locally, so unless your error is indeed related to the SHA fingerprint, it's not a firebase_ui issue, but firebase_auth.

danagbemava-nc commented 5 months ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v. All system setups can be slightly different, so it's always better to open new issues and reference related issues.