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.72k stars 3.97k forks source link

πŸ› [firebase_auth] _TypeError (type 'int' is not a subtype of type 'String' in type cast) on previously working auth code #11871

Closed dacay closed 11 months ago

dacay commented 1 year ago

Bug report

I've recently opened up one of my extra projects, run on the simulator, and tried to log in. Then I tried the old version installed on my phone, same problem.

The error I am receiving is "_TypeError (type 'int' is not a subtype of type 'String' in type cast)" just on the signWithCredential line.

Here's my code for the Google login, but it fails with same error with Facebook and Apple as well.

Future<UserCredential> _signInWithGoogle() async {
  logger.d("Starting Google authentication flow...");

  // Trigger the authentication flow
  final GoogleSignInAccount? googleUser = await GoogleSignIn().signIn();

  // Check if the flow was cancelled
  if (googleUser == null) {
    logger.d("Google authentication flow cancelled.");

    throw FlowCancelledException();
  }

  logger.d("Obtaining credentials from the response...");

  // Obtain the auth details from the request
  final GoogleSignInAuthentication googleAuth = await googleUser.authentication;

  // Create a new credential
  final credential = GoogleAuthProvider.credential(
    accessToken: googleAuth.accessToken,
    idToken: googleAuth.idToken,
  );

  logger.d("Signing in to Firebase with Google credentials...");

  // Once signed in, return the UserCredential
  return await FirebaseAuth.instance.signInWithCredential(credential);
}

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to an app with Firebase auth
  2. Try to login
  3. Login fails when trying to pass credentials to FirebaseAuth

Expected behavior

I expect the login flow to continue as it was working few weeks ago.

Flutter doctor

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [βœ“] Flutter (Channel stable, 3.13.4, on macOS 13.5.1 22G90 darwin-arm64, locale en-TR) [βœ“] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [βœ“] Xcode - develop for iOS and macOS (Xcode 14.3.1) [βœ“] Chrome - develop for the web [!] Android Studio (not installed) [βœ“] IntelliJ IDEA Community Edition (version 2023.2.4) [βœ“] VS Code (version 1.84.1) [βœ“] Connected device (3 available) [βœ“] Network resources ! Doctor found issues in 1 category. ```

Flutter dependencies

Click To Expand ``` Dart SDK 3.1.2 Flutter SDK 3.13.4 jottrail_mobile 1.0.0+1 dependencies: - algolia_helper_flutter 0.3.3 [algolia_helper flutter] - cloud_firestore 4.13.0 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cupertino_icons 1.0.6 - dartx 1.2.0 [characters collection crypto meta path time] - firebase_auth 4.13.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.22.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 3.4.4 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - flip_card 0.7.0 [flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_facebook_auth 6.0.1 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web facebook_auth_desktop] - flutter_quill 7.4.4 [flutter collection flutter_colorpicker flutter_keyboard_visibility quiver url_launcher pedantic characters diff_match_patch i18n_extension device_info_plus platform pasteboard flutter_test] - google_fonts 5.1.0 [flutter http path_provider crypto] - google_sign_in 6.1.5 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - infinite_scroll_pagination 3.2.0 [flutter sliver_tools] - intl 0.18.1 [clock meta path] - local_auth 2.1.7 [flutter local_auth_android local_auth_ios local_auth_platform_interface local_auth_windows] - logger 1.4.0 - lottie 2.6.0 [archive flutter path vector_math] - permission_handler 11.0.1 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface] - provider 6.0.5 [collection flutter nested] - settings_ui 2.0.2 [flutter] - shared_preferences 2.2.1 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - sign_in_with_apple 5.0.0 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web] dev dependencies: - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] dependency overrides: - http 1.1.0 [async http_parser meta] transitive dependencies: - _flutterfire_internals 1.3.12 [collection firebase_core firebase_core_platform_interface flutter meta] - algolia 1.1.2 [meta http uuid universal_io] - algolia_helper 0.3.3 [algolia algolia_insights collection logging meta rxdart] - algolia_insights 0.1.2 [algolia collection hive logging meta path_provider rxdart uuid] - archive 3.3.8 [crypto path pointycastle] - args 2.4.2 - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - cloud_firestore_platform_interface 6.0.4 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.8.4 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.17.2 - convert 3.1.1 [typed_data] - crypto 3.0.3 [typed_data] - device_info_plus 9.0.3 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta win32 win32_registry] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - diff_match_patch 0.4.1 - equatable 2.0.5 [collection meta] - facebook_auth_desktop 1.0.0 [flutter http flutter_secure_storage flutter_facebook_auth_platform_interface] - fake_async 1.3.1 [clock collection] - ffi 2.1.0 - file 6.1.4 [meta path] - firebase_auth_platform_interface 7.0.4 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.8.7 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.6.12 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - flutter_colorpicker 1.0.3 [flutter] - flutter_facebook_auth_platform_interface 5.0.0 [flutter plugin_platform_interface] - flutter_facebook_auth_web 5.0.0 [flutter flutter_web_plugins js flutter_facebook_auth_platform_interface] - flutter_keyboard_visibility 5.4.1 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_linux flutter_keyboard_visibility_macos flutter_keyboard_visibility_web flutter_keyboard_visibility_windows flutter] - flutter_keyboard_visibility_linux 1.0.0 [flutter_keyboard_visibility_platform_interface flutter] - flutter_keyboard_visibility_macos 1.0.0 [flutter_keyboard_visibility_platform_interface flutter] - flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter] - flutter_keyboard_visibility_windows 1.0.0 [flutter_keyboard_visibility_platform_interface flutter] - flutter_plugin_android_lifecycle 2.0.16 [flutter] - flutter_secure_storage 8.1.0 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta] - flutter_secure_storage_linux 1.2.0 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 3.0.1 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.0.2 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.1.2 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js] - flutter_secure_storage_windows 2.1.1 [flutter flutter_secure_storage_platform_interface] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - google_identity_services_web 0.2.1+1 [js meta] - google_sign_in_android 6.1.19 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.6.3 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.4.2 [flutter plugin_platform_interface quiver] - google_sign_in_web 0.12.0+4 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http js] - hive 2.2.3 [meta crypto] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - i18n_extension 9.0.2 [sprintf args equatable intl flutter] - js 0.6.7 [meta] - lints 2.1.1 - local_auth_android 1.0.34 [flutter flutter_plugin_android_lifecycle intl local_auth_platform_interface] - local_auth_ios 1.1.4 [flutter intl local_auth_platform_interface] - local_auth_platform_interface 1.0.8 [flutter plugin_platform_interface] - local_auth_windows 1.0.10 [flutter local_auth_platform_interface] - logging 1.2.0 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.9.1 - nested 1.0.0 [flutter] - pasteboard 0.2.0 [flutter flutter_web_plugins js] - path 1.8.3 - path_provider 2.1.1 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - path_provider_android 2.2.0 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.1 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.1 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - pedantic 1.11.1 - permission_handler_android 11.0.5 [flutter permission_handler_platform_interface] - permission_handler_apple 9.1.4 [flutter permission_handler_platform_interface] - permission_handler_platform_interface 3.11.5 [flutter meta plugin_platform_interface] - permission_handler_windows 0.1.3 [flutter permission_handler_platform_interface] - platform 3.1.2 - plugin_platform_interface 2.1.6 [meta] - pointycastle 3.7.3 [collection convert js] - quiver 3.2.1 [matcher] - rxdart 0.27.7 - shared_preferences_android 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.3.4 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.1 [flutter plugin_platform_interface] - shared_preferences_web 2.2.1 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.3.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sign_in_with_apple_platform_interface 1.0.0 [flutter plugin_platform_interface meta] - sign_in_with_apple_web 1.0.1 [flutter flutter_web_plugins sign_in_with_apple_platform_interface js] - sky_engine 0.0.99 - sliver_tools 0.2.12 [flutter] - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - time 2.1.3 [clock] - typed_data 1.3.2 [collection] - universal_io 2.2.2 [collection meta typed_data] - url_launcher 6.1.14 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - url_launcher_android 6.1.0 [flutter url_launcher_platform_interface] - url_launcher_ios 6.1.5 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.6 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.7 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.5 [flutter plugin_platform_interface] - url_launcher_web 2.0.19 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.8 [flutter url_launcher_platform_interface] - uuid 3.0.7 [crypto] - vector_math 2.1.4 - web 0.1.4-beta - win32 5.0.7 [ffi] - win32_registry 1.1.1 [ffi win32] - xdg_directories 1.0.3 [meta path]```

danagbemava-nc commented 1 year ago

Hi @dacay, were you using an earlier version of the firebase plugins? If so, which versions?

Can you also provide a complete minimal reproducible code sample in a repo that we can clone so that we can investigate this issue?

Also, what platform(s) are you experiencing this issue on?

Thank you

google-oss-bot commented 12 months ago

Hey @dacay. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 11 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@dacay if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.