Closed xmany closed 3 years ago
Having the same issue
Hi @xmany
This was a known issue https://github.com/FirebaseExtended/flutterfire/issues/5941 and has been fixed and the fix has been published.
Please upgrade to the latest firebase_auth: ^1.1.3
Thank you
Bug report
Describe the bug The auth state is supposed to be persistent across app open/close, however, after upgrading to firebase_auth to 1.1.2 and migrate my project to sound null safety, it lost the persistence when app is closed/reopened, it only occurs on iOS, it works fine on Android.
To be specific, I am trying to detect the user auth state by checking
Both will tell me that the user is not signed in, FirebaseAuth.instance.currentUser will be null when starting the app, and the authStateChanges() will not receive the event with a signed-in user.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
the app should remember its sign-in state, auth state shall persist
Sample project
I may be able provide a sample project later
Additional context
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91 darwin-arm, locale en-AU) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] VS Code (version 1.56.0) [✓] Connected device (2 available) • No issues found! ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.12.3 Flutter SDK 2.0.5 icoffee 1.4.1+75 dependencies: - add_2_calendar 2.1.0 [flutter] - clipboard 0.1.3 [flutter] - cloud_firestore 1.0.7 [cloud_firestore_platform_interface cloud_firestore_web firebase_core firebase_core_platform_interface flutter meta] - cloud_functions 1.0.5 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - collection 1.15.0 - connectivity 3.0.3 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web] - crypto 3.0.1 [collection typed_data] - cupertino_icons 1.0.3 - equatable 2.0.0 [collection meta] - firebase_analytics 8.0.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta] - firebase_auth 1.1.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 1.1.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.0.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_messaging 9.1.3 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_storage 8.0.5 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_picker 2.0.1 [flutter] - font_awesome_flutter 9.0.0 [flutter] - geoflutterfire 3.0.0-nullsafety.2 [flutter cloud_firestore rxdart] - get_it 6.1.1 [async collection] - google_fonts 2.0.0 [flutter http path_provider crypto] - google_maps_flutter 2.0.3 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface] - google_sign_in 5.0.2 [google_sign_in_platform_interface google_sign_in_web flutter meta] - group_list_view 1.1.1 [flutter] - icoffee_flutter_core_library 0.0.2 [flutter cloud_firestore device_info logger location connectivity permission_handler tuple] - icoffee_flutter_ui_library 0.0.2 [flutter font_awesome_flutter google_fonts percent_indicator shimmer google_maps_flutter webview_flutter icoffee_flutter_core_library] - image_picker 0.7.4 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web] - in_app_review 2.0.2 [flutter in_app_review_platform_interface] - intl 0.17.0 [clock path] - nfc_info 0.0.5 [flutter] - path 1.8.0 - percent_indicator 3.0.1 [flutter] - permission_handler 7.1.0 [flutter meta permission_handler_platform_interface] - pin_code_fields 7.0.0 [flutter] - provider 5.0.0 [collection flutter nested] - qr_code_scanner 0.4.0 [flutter] - rxdart 0.26.0 - share 2.0.1 [meta mime flutter] - shared_preferences 2.0.5 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows] - shimmer 2.0.0 [flutter] - sign_in_with_apple 3.0.0 [flutter meta] - tuple 2.0.0 [quiver] - url_launcher 6.0.3 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web] dev dependencies: - flutter_launcher_icons 0.9.0 [args image path 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] - pedantic 1.11.0 transitive dependencies: - archive 3.1.2 [crypto path] - args 2.0.0 - async 2.5.0 [collection] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.1.0 - charcode 1.2.0 - clock 1.1.0 - cloud_firestore_platform_interface 4.0.3 [collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 1.0.7 [cloud_firestore_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - cloud_functions_platform_interface 5.0.3 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.0.5 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - connectivity_for_web 0.4.0 [connectivity_platform_interface flutter_web_plugins flutter] - connectivity_macos 0.2.0 [flutter] - connectivity_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - device_info 2.0.0 [flutter device_info_platform_interface] - device_info_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - fake_async 1.2.0 [clock collection] - ffi 1.0.0 - file 6.1.0 [meta path] - firebase 9.0.1 [http http_parser js] - firebase_analytics_platform_interface 2.0.0 [flutter meta] - firebase_analytics_web 0.3.0 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta] - firebase_auth_platform_interface 4.2.1 [firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 1.1.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core_platform_interface 4.0.0 [flutter meta plugin_platform_interface] - firebase_core_web 1.0.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.0.2 [collection firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 2.1.3 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 1.0.6 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_storage_platform_interface 2.0.3 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 1.0.5 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - flutter_plugin_android_lifecycle 2.0.1 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math] - google_maps_flutter_platform_interface 2.0.1 [flutter meta plugin_platform_interface stream_transform collection] - google_sign_in_platform_interface 2.0.1 [flutter meta quiver] - google_sign_in_web 0.10.0 [google_sign_in_platform_interface flutter flutter_web_plugins meta js] - http 0.13.0 [http_parser meta path pedantic] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image 3.0.1 [archive meta xml] - image_picker_for_web 2.0.0 [image_picker_platform_interface meta flutter flutter_web_plugins] - image_picker_platform_interface 2.0.1 [flutter meta http plugin_platform_interface] - in_app_review_platform_interface 2.0.2 [flutter url_launcher plugin_platform_interface platform] - js 0.6.3 - location 4.1.1 [flutter location_platform_interface location_web meta] - location_platform_interface 2.1.0 [flutter meta plugin_platform_interface] - location_web 3.0.0 [flutter flutter_web_plugins http_parser js location_platform_interface meta] - logger 1.0.0 - matcher 0.12.10 [stack_trace] - meta 1.3.0 - mime 1.0.0 - nested 1.0.0 [flutter] - path_provider 2.0.1 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows] - path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 2.0.0 [flutter] - path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface] - path_provider_windows 2.0.0 [path_provider_platform_interface meta path flutter ffi win32] - permission_handler_platform_interface 3.3.0 [flutter meta plugin_platform_interface] - petitparser 4.0.2 [meta] - platform 3.0.0 - plugin_platform_interface 2.0.0 [meta] - process 4.1.0 [file path platform] - quiver 3.0.0 [matcher] - shared_preferences_linux 2.0.0 [flutter file meta path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 2.0.0 [shared_preferences_platform_interface flutter] - shared_preferences_platform_interface 2.0.0 [flutter] - shared_preferences_web 2.0.0 [shared_preferences_platform_interface flutter flutter_web_plugins meta] - shared_preferences_windows 2.0.0 [shared_preferences_platform_interface flutter file meta path path_provider_platform_interface path_provider_windows] - sky_engine 0.0.99 - source_span 1.8.0 [charcode collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - stream_transform 2.0.0 - string_scanner 1.1.0 [charcode source_span] - term_glyph 1.2.0 - test_api 0.2.19 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0 [collection] - url_launcher_linux 2.0.0 [flutter] - url_launcher_macos 2.0.0 [flutter] - url_launcher_platform_interface 2.0.1 [flutter plugin_platform_interface] - url_launcher_web 2.0.0 [url_launcher_platform_interface meta flutter flutter_web_plugins] - url_launcher_windows 2.0.0 [flutter] - vector_math 2.1.0 - webview_flutter 2.0.4 [flutter] - win32 2.0.4 [ffi] - xdg_directories 0.2.0 [meta path process] - xml 5.0.2 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```