Skip to content

[firebase_auth]: account linking not working #17219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
avinashk369 opened this issue Mar 22, 2025 · 7 comments
Open
1 task done

[firebase_auth]: account linking not working #17219

avinashk369 opened this issue Mar 22, 2025 · 7 comments
Labels
Needs Attention This issue needs maintainer attention. platform: android Issues / PRs which are specifically for Android. platform: ios Issues / PRs which are specifically for iOS. plugin: auth type: bug Something isn't working

Comments

@avinashk369
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Android, iOS

Description

in my flutter application i have following auth providers for login

  • google
  • twitter
  • facebook
  • apple

account linking is enabled in firebase authentication setting.
Expectation is to link providers to single account but actually getting account-exists-with-different-credential. surprisingly these is a case when it works as well.

working case -

  1. login with any providers available except google
  2. log out to the application
  3. login with google with same email
  4. account linking works seamlessly

not working case -

  1. login with google first
  2. logout to the application
  3. login with other provider except google with same email
  4. exception thrown account-exists-with-different-credential.

Expecting account linking handling seamlessly and automatically or should provide an option to link account manually even when user is not logged in.

Reproducing the issue

google sign in

try {
      
      final GoogleSignInAccount? googleUser = await googleSignIn.signIn();

     
      final GoogleSignInAuthentication? googleAuth =
          await googleUser?.authentication;

      
      final credential = GoogleAuthProvider.credential(
        accessToken: googleAuth?.accessToken,
        idToken: googleAuth?.idToken,
      );
      
      return _signInWithCredential(credential);
    } catch (e) {
      log(e.toString());
      rethrow;
    }

twitter log in

i have twitter app properly set up and i am also able to get user email post authorisation from twitter

try {
          TwitterAuthProvider twitterProvider = TwitterAuthProvider();
          
          return await FirebaseAuth.instance.signInWithProvider(twitterProvider);
        } on FirebaseAuthException catch (e) {
          if (e.code == 'account-exists-with-different-credential') {
           /// exception caught here
          } 
        }
Future<UserCredential?> _signInWithCredential(
      AuthCredential credential) async {
    try {
      // Try signing in with the provided credential
      final UserCredential userCredential =
          await _auth.signInWithCredential(credential);

      return userCredential;
    } on FirebaseAuthException catch (e) {
      // Handle account exists with different credential error
      if (e.code == 'account-exists-with-different-credential') {
       ///
      } 
    }
  }

Firebase Core version

3.6.0

Flutter Version

3.27.4

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.6.2
Flutter SDK 3.27.4
crowd_wallet 3.0.7+307

dependencies:
- ably_flutter 1.2.37 [collection flutter meta]
- app_links 6.4.0 [flutter app_links_linux app_links_platform_interface app_links_web]
- btc_address_validate_swan 1.2.1 [dart_bech32 base58check equatable bech32]
- built_value 8.9.3 [built_collection collection fixnum meta]
- cached_network_image 3.4.1 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image]
- carousel_slider 5.0.0 [flutter]
- chart_sparkline 1.1.1 [flutter]
- crypto 3.0.6 [typed_data]
- cupertino_icons 1.0.8
- currency_converter 2.0.0 [flutter http intl]
- dart_jsonwebtoken 2.14.2 [crypto pointycastle convert collection ed25519_edwards clock]
- dio 5.7.0 [async http_parser meta path dio_web_adapter]
- encrypt 5.0.3 [args asn1lib clock collection crypto pointycastle]
- envied 1.1.1
- firebase_auth 5.3.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 3.12.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 4.2.0 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_messaging 15.2.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_performance 0.10.0+11 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter]
- firebase_remote_config 5.2.0 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_cache_manager 3.4.1 [clock collection file flutter http path path_provider rxdart sqflite uuid]
- flutter_facebook_auth 7.1.1 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web facebook_auth_desktop]
- flutter_html 3.0.0-beta.2 [html csslib collection list_counter flutter]
- flutter_inappwebview 6.1.5 [flutter flutter_inappwebview_platform_interface flutter_inappwebview_android flutter_inappwebview_ios flutter_inappwebview_macos flutter_inappwebview_web flutter_inappwebview_windows]
- flutter_local_notifications 18.0.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_otp_text_field 1.4.0+2 [flutter]
- flutter_secure_storage 9.2.4 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta]
- flutter_slidable 3.1.2 [flutter]
- flutter_svg 2.0.16 [flutter http vector_graphics vector_graphics_codec vector_graphics_compiler]
- get 4.6.6 [flutter]
- get_it 8.0.3 [async collection meta]
- get_storage 2.1.1 [flutter get path_provider]
- google_fonts 6.2.1 [flutter http path_provider crypto]
- google_sign_in 6.2.2 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web]
- hive 2.2.3 [meta crypto]
- http 1.2.2 [async http_parser meta web]
- http_certificate_pinning 2.1.3 [dio flutter http]
- image_picker 1.1.2 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows]
- intl 0.19.0 [clock meta path]
- live_currency_rate 1.0.8 [flutter http]
- local_auth 2.3.0 [flutter local_auth_android local_auth_darwin local_auth_platform_interface local_auth_windows]
- logger 2.5.0
- mobile_scanner 6.0.7 [flutter flutter_web_plugins plugin_platform_interface web]
- modal_bottom_sheet 3.0.0 [flutter]
- network_monitor_cp 0.0.6 [flutter connectivity_plus]
- package_info_plus 8.1.2 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32 clock]
- path_provider 2.1.5 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
- permission_handler 11.3.1 [flutter meta permission_handler_android permission_handler_apple permission_handler_html permission_handler_windows permission_handler_platform_interface]
- pinput 5.0.0 [flutter universal_platform]
- pull_to_refresh_plus 2.0.3 [flutter]
- qr_flutter 4.1.0 [flutter qr]
- readmore 3.0.0 [flutter]
- share_plus 10.1.3 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi web win32]
- shimmer 3.0.0 [flutter]
- sign_in_with_apple 6.1.4 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web]
- socket_io_client 3.0.2 [logging socket_io_common]
- syncfusion_flutter_charts 27.2.5 [flutter intl vector_math syncfusion_flutter_core]
- synchronized 3.3.0+3
- timeago 3.7.0 [intl]
- tutorial_coach_mark 1.2.12 [flutter]
- twitter_login 4.4.2 [crypto flutter http]
- url_launcher 6.3.1 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- video_player 2.9.2 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web]
- web_socket_channel 3.0.1 [async crypto stream_channel web web_socket]
- webview_flutter 4.10.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]

dev dependencies:
- build_runner 2.4.15 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web web_socket_channel yaml]
- built_value_generator 8.9.5 [analyzer build build_config built_collection built_value collection source_gen]
- envied_generator 1.1.1 [envied build code_builder source_gen analyzer recase equatable]
- flutter_lints 5.0.0 [lints]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]

dependency overrides:
- intl 0.19.0 [clock meta path]

transitive dependencies:
- _fe_analyzer_shared 80.0.0 [meta]
- _flutterfire_internals 1.3.53 [collection firebase_core firebase_core_platform_interface flutter meta]
- adaptive_number 1.0.0 [fixnum]
- analyzer 7.3.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- app_links_linux 1.0.3 [flutter app_links_platform_interface gtk]
- app_links_platform_interface 2.0.2 [flutter plugin_platform_interface]
- app_links_web 1.0.4 [flutter flutter_web_plugins app_links_platform_interface web]
- args 2.6.0
- asn1lib 1.5.8
- async 2.11.0 [collection meta]
- base58check 2.0.0 [crypto collection]
- bech32 0.2.2 [convert]
- boolean_selector 2.1.1 [source_span string_scanner]
- build 2.4.2 [analyzer async convert crypto glob logging meta package_config path]
- build_config 1.1.2 [checked_yaml json_annotation path pubspec_parse yaml]
- build_daemon 4.0.4 [built_collection built_value crypto http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 2.4.4 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml]
- build_runner_core 8.0.0 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml]
- built_collection 5.1.1
- cached_network_image_platform_interface 4.1.1 [flutter flutter_cache_manager]
- cached_network_image_web 1.3.1 [cached_network_image_platform_interface flutter flutter_cache_manager web]
- characters 1.3.0
- checked_yaml 2.0.3 [json_annotation source_span yaml]
- clock 1.1.1
- code_builder 4.10.1 [built_collection built_value collection matcher meta]
- collection 1.19.0
- connectivity_plus 6.1.1 [flutter flutter_web_plugins connectivity_plus_platform_interface web meta nm collection]
- connectivity_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- convert 3.1.2 [typed_data]
- cross_file 0.3.4+2 [meta web]
- csslib 0.17.3 [source_span]
- dart_bech32 1.0.1
- dart_style 3.0.1 [analyzer args collection package_config path pub_semver source_span yaml]
- dbus 0.7.10 [args ffi meta xml]
- dio_web_adapter 2.0.0 [dio http_parser meta web]
- ed25519_edwards 0.3.1 [collection crypto convert adaptive_number]
- equatable 2.0.7 [collection meta]
- facebook_auth_desktop 2.1.1 [flutter http flutter_secure_storage flutter_facebook_auth_platform_interface]
- fake_async 1.3.1 [clock collection]
- ffi 2.1.3
- file 7.0.1 [meta path]
- file_selector_linux 0.9.3+2 [cross_file file_selector_platform_interface flutter]
- file_selector_macos 0.9.4+2 [cross_file file_selector_platform_interface flutter]
- file_selector_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface]
- file_selector_windows 0.9.3+3 [cross_file file_selector_platform_interface flutter]
- firebase_auth_platform_interface 7.4.10 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.13.5 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core_platform_interface 5.4.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.21.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- firebase_crashlytics_platform_interface 3.7.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_platform_interface 4.6.4 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.10.4 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web]
- firebase_performance_platform_interface 0.1.4+47 [_flutterfire_internals firebase_core flutter plugin_platform_interface]
- firebase_performance_web 0.1.7+5 [_flutterfire_internals firebase_core firebase_core_web firebase_performance_platform_interface flutter flutter_web_plugins]
- firebase_remote_config_platform_interface 1.4.47 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.7.5 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins]
- fixnum 1.1.1
- flutter_facebook_auth_platform_interface 6.1.2 [flutter plugin_platform_interface]
- flutter_facebook_auth_web 6.1.2 [flutter flutter_web_plugins flutter_facebook_auth_platform_interface web]
- flutter_inappwebview_android 1.1.3 [flutter flutter_inappwebview_platform_interface]
- flutter_inappwebview_internal_annotations 1.2.0
- flutter_inappwebview_ios 1.1.2 [flutter flutter_inappwebview_platform_interface]
- flutter_inappwebview_macos 1.1.2 [flutter flutter_inappwebview_platform_interface]
- flutter_inappwebview_platform_interface 1.3.0+1 [flutter flutter_inappwebview_internal_annotations plugin_platform_interface]
- flutter_inappwebview_web 1.1.2 [flutter flutter_web_plugins web flutter_inappwebview_platform_interface]
- flutter_inappwebview_windows 0.6.0 [flutter flutter_inappwebview_platform_interface]
- flutter_local_notifications_linux 5.0.0 [dbus ffi flutter flutter_local_notifications_platform_interface path xdg_directories]
- flutter_local_notifications_platform_interface 8.0.0 [flutter plugin_platform_interface]
- flutter_plugin_android_lifecycle 2.0.24 [flutter]
- flutter_secure_storage_linux 1.2.2 [flutter flutter_secure_storage_platform_interface]
- flutter_secure_storage_macos 3.1.3 [flutter flutter_secure_storage_platform_interface]
- flutter_secure_storage_platform_interface 1.1.2 [flutter plugin_platform_interface]
- flutter_secure_storage_web 1.2.1 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js]
- flutter_secure_storage_windows 3.1.2 [ffi flutter flutter_secure_storage_platform_interface path path_provider win32]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- frontend_server_client 4.0.0 [async path]
- glob 2.1.3 [async collection file path string_scanner]
- google_identity_services_web 0.3.3 [meta web]
- google_sign_in_android 6.1.34 [flutter google_sign_in_platform_interface]
- google_sign_in_ios 5.7.8 [flutter google_sign_in_platform_interface]
- google_sign_in_platform_interface 2.4.5 [flutter plugin_platform_interface]
- google_sign_in_web 0.12.4+3 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http web]
- graphs 2.3.2 [collection]
- gtk 2.1.0 [ffi flutter meta]
- html 0.15.4 [csslib source_span]
- http_multi_server 3.2.2 [async]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- image_picker_android 0.8.12+19 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 3.0.6 [flutter flutter_web_plugins image_picker_platform_interface mime web]
- image_picker_ios 0.8.12+2 [flutter image_picker_platform_interface]
- image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface]
- image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface]
- image_picker_platform_interface 2.10.0 [cross_file flutter http plugin_platform_interface]
- image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface]
- io 1.0.5 [meta path string_scanner]
- js 0.6.7 [meta]
- json_annotation 4.9.0 [meta]
- leak_tracker 10.0.7 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 3.0.8 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
- lints 5.0.0
- list_counter 1.0.2
- local_auth_android 1.0.46 [flutter flutter_plugin_android_lifecycle intl local_auth_platform_interface]
- local_auth_darwin 1.4.2 [flutter intl local_auth_platform_interface]
- local_auth_platform_interface 1.0.10 [flutter plugin_platform_interface]
- local_auth_windows 1.0.11 [flutter local_auth_platform_interface]
- logging 1.3.0
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.11.1 [collection]
- meta 1.15.0
- mime 2.0.0
- nm 0.5.0 [dbus]
- octo_image 2.1.0 [flutter]
- package_config 2.2.0 [path]
- package_info_plus_platform_interface 3.0.2 [flutter meta plugin_platform_interface]
- path 1.9.0
- path_parsing 1.1.0 [meta vector_math]
- path_provider_android 2.2.15 [flutter path_provider_platform_interface]
- path_provider_foundation 2.4.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.2 [flutter platform plugin_platform_interface]
- path_provider_windows 2.3.0 [ffi flutter path path_provider_platform_interface]
- permission_handler_android 12.0.13 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.4.5 [flutter permission_handler_platform_interface]
- permission_handler_html 0.1.3+5 [flutter flutter_web_plugins permission_handler_platform_interface web]
- permission_handler_platform_interface 4.2.3 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.2.1 [flutter permission_handler_platform_interface]
- petitparser 6.0.2 [meta]
- platform 3.1.6
- plugin_platform_interface 2.1.8 [meta]
- pointycastle 3.9.1 [collection convert js]
- pool 1.5.1 [async stack_trace]
- pub_semver 2.2.0 [collection]
- pubspec_parse 1.5.0 [checked_yaml collection json_annotation pub_semver yaml]
- qr 3.0.2 [meta]
- recase 4.1.0
- rxdart 0.28.0
- share_plus_platform_interface 5.0.2 [cross_file flutter meta mime plugin_platform_interface path_provider uuid]
- shelf 1.4.1 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 3.0.0 [shelf stream_channel web_socket_channel]
- sign_in_with_apple_platform_interface 1.1.0 [flutter plugin_platform_interface meta]
- sign_in_with_apple_web 2.1.1 [flutter flutter_web_plugins sign_in_with_apple_platform_interface]
- sky_engine 0.0.0
- socket_io_common 3.0.1 [logging]
- source_gen 2.0.0 [analyzer async build dart_style glob path pub_semver source_span yaml]
- source_span 1.10.0 [collection path term_glyph]
- sprintf 7.0.0
- sqflite 2.4.1 [flutter sqflite_android sqflite_darwin sqflite_platform_interface sqflite_common path]
- sqflite_android 2.4.0 [flutter sqflite_common path sqflite_platform_interface]
- sqflite_common 2.5.4+6 [synchronized path meta]
- sqflite_darwin 2.4.1+1 [flutter sqflite_platform_interface meta sqflite_common path]
- sqflite_platform_interface 2.4.0 [flutter platform sqflite_common plugin_platform_interface meta]
- stack_trace 1.12.0 [path]
- stream_channel 2.1.2 [async]
- stream_transform 2.1.1
- string_scanner 1.3.0 [source_span]
- syncfusion_flutter_core 27.2.5 [vector_math flutter]
- term_glyph 1.2.1
- test_api 0.7.3 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- timezone 0.9.4 [path]
- timing 1.0.2 [json_annotation]
- typed_data 1.4.0 [collection]
- universal_platform 1.1.0
- url_launcher_android 6.3.14 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.3.2 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.2.1 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.2.2 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.3.2 [flutter plugin_platform_interface]
- url_launcher_web 2.3.3 [flutter flutter_web_plugins url_launcher_platform_interface web]
- url_launcher_windows 3.1.3 [flutter url_launcher_platform_interface]
- uuid 4.5.1 [crypto sprintf meta fixnum]
- vector_graphics 1.1.15 [flutter http vector_graphics_codec]
- vector_graphics_codec 1.1.12
- vector_graphics_compiler 1.1.16 [args meta path path_parsing vector_graphics_codec xml]
- vector_math 2.1.4
- video_player_android 2.7.16 [flutter video_player_platform_interface]
- video_player_avfoundation 2.6.5 [flutter video_player_platform_interface]
- video_player_platform_interface 6.2.3 [flutter plugin_platform_interface]
- video_player_web 2.3.3 [flutter flutter_web_plugins video_player_platform_interface web]
- vm_service 14.3.0
- watcher 1.1.1 [async path]
- web 1.1.0
- web_socket 0.1.6 [web]
- webview_flutter_android 4.2.0 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 2.10.0 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 3.16.3 [flutter path webview_flutter_platform_interface]
- win32 5.10.0 [ffi]
- xdg_directories 1.1.0 [meta path]
- xml 6.5.0 [collection meta petitparser]
- yaml 3.1.3 [collection source_span string_scanner]

</details>

Additional context and comments

No response

@avinashk369 avinashk369 added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Mar 22, 2025
@SelaseKay SelaseKay added plugin: auth platform: android Issues / PRs which are specifically for Android. platform: ios Issues / PRs which are specifically for iOS. labels Mar 24, 2025
@avinashk369
Copy link
Author

requesting to reopen this as well 13467.

reproducing this only has to make one change in firebase console authentication settings.
change the account linking settings from

  • Link accounts that use the same email

to

  • Create multiple accounts for each identity provider

However signinWithProvider or signInWithCredentials makes entry in the firebase with email and provider info but it doesn't return into UserCredentials.

@SelaseKay
Copy link
Contributor

Hi @avinashk369, the account-exist-with-different-credential error is expected as your account is already tied to a different provider. This is clearly stated in the doc. Kindly let me know if this helps.

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Mar 24, 2025
@avinashk369
Copy link
Author

Hi @avinashk369, the account-exist-with-different-credential error is expected as your account is already tied to a different provider. This is clearly stated in the doc. Kindly let me know if this helps.

Thank you for considering the request. as per the doc it says, first get all the sign in methods and then ask user to use that method for login then you can link the account.

  • List<String> userSignInMethods = await auth.fetchSignInMethodsForEmail(email);
    fetchSignInMethodsForEmail is deprecated in firebase_auth

  • if this is the intended behaviour then how come account linking works seamlessly when the first sign in method is different provider than google.
    steps to check - login with facebook/twitter/email -> logout to the application -> now login with google.
    in this case you will not get account-exist-with-different-credential issue and firebase account linking will merge the existing provider with google.

let me know if i can provide you any additional info required.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Mar 25, 2025
@MichaelVerdon
Copy link
Contributor

Hi there, thank you for the information @avinashk369 can I just confirm I am understanding the issue correctly? So the error "account-exist-with-different-credential" is thrown only when you use a Google provider with an existing account or is the Google account the first one registered then any other provider fetches the error? If what you described is true that is definitely odd and I am happy to investigate it 😄 .

@MichaelVerdon MichaelVerdon added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Mar 27, 2025
@MichaelVerdon
Copy link
Contributor

Is your issue related to this one? #17160 Because if so, we have a fix out. The user here was using google-sign in

@avinashk369
Copy link
Author

avinashk369 commented Apr 1, 2025

Hi there, thank you for the information @avinashk369 can I just confirm I am understanding the issue correctly? So the error "account-exist-with-different-credential" is thrown only when you use a Google provider with an existing account or is the Google account the first one registered then any other provider fetches the error? If what you described is true that is definitely odd and I am happy to investigate it 😄 .

indeed its pretty weird that "account-exist-with-different-credential" is thrown only when first provider is google and you use other provider like twitter, facebook or email after that. moreover if your first provider is twitter, facbook or email and you use google then you don't get this "account-exist-with-different-credential" and in this case account linking doesn't requires any additional changes. it works seamlessly and automatically.

please also consider the following one as well.

requesting to reopen this as well 13467.

reproducing this only has to make one change in firebase console authentication settings. change the account linking settings from

  • Link accounts that use the same email

to

  • Create multiple accounts for each identity provider

However signinWithProvider or signInWithCredentials makes entry in the firebase with email and provider info but it doesn't return into UserCredentials.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Apr 1, 2025
@MichaelVerdon
Copy link
Contributor

We should have the PR I mentioned earlier merged at some point soon, when it is merged I can let you know and would like to know if it resolves your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: android Issues / PRs which are specifically for Android. platform: ios Issues / PRs which are specifically for iOS. plugin: auth type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants