Repository navigation
[firebase_auth] MFA codeSent deepLink resetting/overriding navigation stack. #17035
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Auth
Which platforms are affected?
iOS
Description
Logging into an user that is fully set up with MFA fails on IOS but not on Andriod. Immediately after logging in I get a FirebaseAuthMultiFactorException [firebase_auth/second-factor-required] error and after the recaptcha is completes a deep link is provided and then it proceeds to boot me.
Reproducing the issue
Future loginWithEmailAndPassword(String email, String password) async {
try {
// Attempt to login
await _auth.signInWithEmailAndPassword(email: email, password: password);
} on FirebaseAuthMultiFactorException catch (e) {
debugPrint(e.toString());
_resolver = e.resolver;
LoginController.instance.changeMfaStatus();
await sendMfaLoginCode();
final ex = ExceptionHandling.code(e.code).message;
throw ex;
} on FirebaseAuthException catch (e) {
final ex = ExceptionHandling.code(e.code).message;
throw ex;
} catch (e) {
// Handle any other exceptions that might occur
const ex = ExceptionHandling();
throw ex;
}
}
Firebase Core version
3.6.0
Flutter Version
3.27.1
Relevant Log Output
flutter: [firebase_auth/second-factor-required] Error Domain=FIRAuthErrorDomain Code=17078 "Please complete a second factor challenge to finish signing into this account." UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_SECOND_FACTOR_REQUIRED, FIRAuthErrorUserInfoMultiFactorResolverKey=<FIRMultiFactorResolver: 0x600000cb0300>, NSLocalizedDescription=Please complete a second factor challenge to finish signing into this account.}
[GETX] GOING TO ROUTE /link?deep_link_id=https://bridgebanking.firebaseapp.com/__/auth/callback?authType=verifyApp&recaptchaToken=03AFcWeA6p8p1B9eh-B_xruekW1stgYt0YALya7unT-T8Woy1I5nYT_dfRmCwy_zBzGpVT48SADQb8Sfu80xz8C0amW920bp9fPKBt6X7j_95GXhVNKU1okotwVQJQi2b6TNvYuiYtK53gDCwZztIzNNOBmzqGl5LilEOU0N80zXynxHo0jBkoPdDrqUlzTOoqrOjH--oX1WLScV-lcf0nyy23Jxk47qPHDxkTvcFzgSGJO2C_dCyj1Q8_C8XAQPp5PPo9ZJJPELD0ikV-yQKHI5CCyHa7OnSAhiJBFYsJSq3Gopojb1igkbkPBL0Hcfl2_t6jp80WOXSb1-Gs1IDAg9tzVvW713qTpvVtpW_Tr1CS5jlSYA4j24iVErX17xrvx7xnDuuB3v15tETklIyWLPuxHhKkJP9cSZdySmN9qbZddPQY_Gd1vanGyEph9itaDXiC5PG8_rXs9Tbwx1z-8yI-2BGiAmsVgCar8sLgUB6rijoBHgGG93BrAd1WRQyZUnDOSj_yADBrsyaPAidmUW1AtmtJXr-xVoUSQDs8Re-CTpIurwM0GTXbE2E170TYJ596JTXGr20ovCzQD4hldLnF-Xh1A6Zq2IOZP2GOckUtzEYYZmZ3zON5EI8Bm_nurZkLTlsy7L_lm75VwFtWlG-2AqfFtrfbA_p8T3AkH-0y0DJIKEBmR_UGh-DfntnEjKCD5yKnpX72zHi2--9GzaiksX232uRQo8P3EUWfITFo-zHwV3XUy2SjxwHGOjrcXNKACH08K5BM44qwu3Vf8Co9W2bhiyAe0RhJNynUH9yLrV0zIgtXyqojrUv1UOGp7jJzx_OCBDRCJGHOgCA-RhskHAUQntTHslv9gu6leaxwE2dYcaQU7Qxi_mUNWVvrPvxBUkPSVrLIziREDQeH3Jx1QfMt_MHfTHuvhTdR3ynIJo3oikhLS3DehSBXaQg_RHtu7TkHNITtzaykNjnTU_uY5kuqC2GW-OJflbOTZzmyJpRoGvD399PLhLoSUKJyoCcrVeZcWyHEgAvZv_kBY7X0enHEyY_6Vg&eventId=OLVJQIOFLYFlutter dependencies
Expand Flutter dependencies snippet
Dart SDK 3.6.0
Flutter SDK 3.27.1
bridgeapp 2.0.0+1
dependencies:
- cloud_firestore 5.6.0 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- cupertino_icons 1.0.8
- encrypt 5.0.3 [args asn1lib clock collection crypto pointycastle]
- firebase_auth 5.3.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 3.9.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_database 11.2.0 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter]
- fl_chart 0.40.6 [flutter equatable]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_native_splash 2.4.3 [args flutter flutter_web_plugins html image meta path universal_io xml yaml ansicolor]
- flutter_otp_text_field 1.2.0 [flutter]
- flutter_pdfview 1.3.4 [flutter]
- get 4.6.6 [flutter]
- http 1.2.2 [async http_parser meta web]
- 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]
- logger 2.5.0
- mockito 5.4.5 [analyzer build code_builder collection dart_style matcher meta path source_gen test_api]
- path_provider 2.1.5 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
- plaid_flutter 4.1.1 [flutter flutter_web_plugins plugin_platform_interface js]
- shared_preferences 2.3.4 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- smooth_page_indicator 1.2.0+3 [flutter]
- 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]
- vibration 2.0.1 [flutter vibration_platform_interface]
dev dependencies:
- flutter_launcher_icons 0.14.2 [args checked_yaml cli_util image json_annotation path yaml]
- 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]
transitive dependencies:
- _fe_analyzer_shared 78.0.0 [meta]
- _flutterfire_internals 1.3.48 [collection firebase_core firebase_core_platform_interface flutter meta]
- _macros 0.3.3
- analyzer 7.1.0 [_fe_analyzer_shared collection convert crypto glob macros meta package_config path pub_semver source_span watcher yaml]
- ansicolor 2.0.3
- archive 4.0.2 [crypto path posix]
- args 2.6.0
- asn1lib 1.5.8
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- build 2.4.2 [analyzer async convert crypto glob logging meta package_config path]
- built_collection 5.1.1
- built_value 8.9.3 [built_collection collection fixnum meta]
- characters 1.3.0
- checked_yaml 2.0.3 [json_annotation source_span yaml]
- cli_util 0.4.2 [meta path]
- clock 1.1.1
- cloud_firestore_platform_interface 6.6.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 4.4.0 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins]
- code_builder 4.10.1 [built_collection built_value collection matcher meta]
- collection 1.19.0
- convert 3.1.2 [typed_data]
- cross_file 0.3.4+2 [meta web]
- crypto 3.0.6 [typed_data]
- csslib 1.0.2 [source_span]
- dart_style 3.0.0 [analyzer args collection package_config path pub_semver source_span yaml]
- device_info_plus 11.2.0 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta web win32 win32_registry]
- device_info_plus_platform_interface 7.0.2 [flutter meta plugin_platform_interface]
- equatable 2.0.7 [collection meta]
- 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.19.0 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- firebase_database_platform_interface 0.2.5+47 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_database_web 0.2.6+5 [collection firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins]
- fixnum 1.1.1
- flutter_plugin_android_lifecycle 2.0.24 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- glob 2.1.2 [async collection file path string_scanner]
- html 0.15.5 [csslib source_span]
- http_parser 4.1.1 [collection source_span string_scanner typed_data]
- image 4.5.2 [archive meta xml]
- image_picker_android 0.8.12+20 [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.1 [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]
- js 0.7.1
- 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.1.0
- logging 1.3.0
- macros 0.1.3-main.0 [_macros]
- 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
- package_config 2.1.1 [path]
- path 1.9.0
- 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]
- petitparser 6.0.2 [meta]
- platform 3.1.6
- plugin_platform_interface 2.1.8 [meta]
- pointycastle 3.9.1 [collection convert js]
- posix 6.0.1 [ffi meta path]
- pub_semver 2.1.5 [collection meta]
- shared_preferences_android 2.4.0 [flutter shared_preferences_platform_interface]
- shared_preferences_foundation 2.5.4 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.4.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.4.1 [flutter plugin_platform_interface]
- shared_preferences_web 2.4.2 [flutter flutter_web_plugins shared_preferences_platform_interface web]
- shared_preferences_windows 2.4.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sky_engine 0.0.0
- 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]
- stack_trace 1.12.0 [path]
- stream_channel 2.1.2 [async]
- string_scanner 1.3.0 [source_span]
- 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]
- typed_data 1.4.0 [collection]
- universal_io 2.2.2 [collection meta typed_data]
- 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.4.0 [flutter flutter_web_plugins url_launcher_platform_interface web]
- url_launcher_windows 3.1.4 [flutter url_launcher_platform_interface]
- vector_math 2.1.4
- vibration_platform_interface 0.0.2 [flutter plugin_platform_interface device_info_plus]
- vm_service 14.3.0
- watcher 1.1.1 [async path]
- web 1.1.0
- win32 5.9.0 [ffi]
- win32_registry 1.1.5 [ffi win32]
- xdg_directories 1.1.0 [meta path]
- xml 6.5.0 [collection meta petitparser]
- yaml 3.1.2 [collection source_span string_scanner]
Additional context and comments
No response
Activity
SelaseKay commentedon Feb 3, 2025
Hi @Juliusman33, the behaviour appears to be similar in my case for my both Android and iOS(
FirebaseAuthMultiFactorExceptionwas thrown on both platforms). You could try referencing the firebase_auth example app to see if you're missing something. Also, ensure your FlutterFire plugins are updated to the latest version. Let me know if you need further assistance.Juliusman33 commentedon Feb 5, 2025
Hey @SelaseKay , Looked into thee firebase auth example. Don't think it applies in this case as the reverse client ID is intended for google sign-in which we don't do on our app. Not the less I went on to enable google sign in via the console to obtain a reverse client Id and follow the directions, but I continue to get the exact same error. I also ran this with the latest plugins as you suggested. Let me know if you would like to see any other files
`
Dart SDK 3.6.0
Flutter SDK 3.27.1
bridgeapp 2.0.0+1
dependencies:
dev dependencies:
transitive dependencies:
`
SelaseKay commentedon Feb 5, 2025
Hi @Juliusman33, we can't investigate this further without a way to reproduce the issue. Could you share a minimal repository that demonstrates the problem? It doesn’t have to be your actual app, just a small example that replicates the issue. A link to the repo would help me clone and test it.
Also, to clarify, your concern is that Android isn't throwing the FirebaseAuthMultiFactorException while iOS does, correct?
Juliusman33 commentedon Feb 8, 2025
Hi @SelaseKay,
Just to confirm the problem/error only occurs on IOS and thankfully not on Android. You can log in using our demo account User: apple@bridgebanking.info
Pass: Guestpass-123
MFA Code: 123456
I have added you as a collaborator to the min repo and here is the link: https://github.com/Juliusman33/bridgeproject-min_repo
Juliusman33 commentedon Feb 14, 2025
Hi @SelaseKay, just wondering if you were able to reproduce this issue with the repo?
SelaseKay commentedon Feb 14, 2025
Hi @Juliusman33, I was able to reproduce the exception using your repo. However, as mentioned earlier, this behavior is expected, as explained here. You'll need to handle and resolve it within the
codeSentcallback. I recommend callingverifyMfaLoginCodeinsidecodeSentto complete the MFA process.Juliusman33 commentedon Feb 16, 2025
Hey @SelaseKay I figured it out. I suppose the SecondFactor Auth error is expected, which triggers sending the code... not sure why I forgot that, my bad. The true problem was the codeSent triggers the Getx deeplink, the getx deeplink would then result in resets the navigation stack, which would cause the code on my end to malfunction. This is weird nonetheless that it is happening only on IOS when it didn't occur before. Any thoughts on that? I did a work around for it either way and I appreciate your genius help once again.
Juliusman33 commentedon Feb 18, 2025
Just for anyone reading this thread. Flutter’s built-in deep linking was resetting the navigation stack, but Firebase was still correctly handling the deep link events for MFA. It was a quick fix to IOS info.plist by adding the below.
Instructions are here for IOS/Android fix.
[-][firebase_auth/second-factor-required]: Second Factor Auth failing in IOS[/-][+][firebase_auth] MFA codeSent deepLink resetting/overriding navigation stack.[/+]