@@ -492,10 +492,16 @@ class FirebaseAuth extends FirebasePluginPlatform {
492492 /// - Thrown if the credential is a [PhoneAuthProvider.credential] and the
493493 /// verification ID of the credential is not valid.id.
494494 Future <UserCredential > signInWithCredential (AuthCredential credential) async {
495- return UserCredential ._(
496- this ,
497- await _delegate.signInWithCredential (credential),
498- );
495+ try {
496+ return UserCredential ._(
497+ this ,
498+ await _delegate.signInWithCredential (credential),
499+ );
500+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
501+ throw FirebaseAuthMultiFactorException ._(this , e);
502+ } catch (e) {
503+ rethrow ;
504+ }
499505 }
500506
501507 /// Tries to sign in a user with a given custom token.
@@ -519,7 +525,14 @@ class FirebaseAuth extends FirebasePluginPlatform {
519525 /// - **invalid-custom-token**:
520526 /// - Thrown if the custom token format is incorrect.
521527 Future <UserCredential > signInWithCustomToken (String token) async {
522- return UserCredential ._(this , await _delegate.signInWithCustomToken (token));
528+ try {
529+ return UserCredential ._(
530+ this , await _delegate.signInWithCustomToken (token));
531+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
532+ throw FirebaseAuthMultiFactorException ._(this , e);
533+ } catch (e) {
534+ rethrow ;
535+ }
523536 }
524537
525538 /// Attempts to sign in a user with the given email address and password.
@@ -545,10 +558,16 @@ class FirebaseAuth extends FirebasePluginPlatform {
545558 required String email,
546559 required String password,
547560 }) async {
548- return UserCredential ._(
549- this ,
550- await _delegate.signInWithEmailAndPassword (email, password),
551- );
561+ try {
562+ return UserCredential ._(
563+ this ,
564+ await _delegate.signInWithEmailAndPassword (email, password),
565+ );
566+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
567+ throw FirebaseAuthMultiFactorException ._(this , e);
568+ } catch (e) {
569+ rethrow ;
570+ }
552571 }
553572
554573 /// Signs in using an email address and email sign-in link.
@@ -570,10 +589,16 @@ class FirebaseAuth extends FirebasePluginPlatform {
570589 required String email,
571590 required String emailLink,
572591 }) async {
573- return UserCredential ._(
574- this ,
575- await _delegate.signInWithEmailLink (email, emailLink),
576- );
592+ try {
593+ return UserCredential ._(
594+ this ,
595+ await _delegate.signInWithEmailLink (email, emailLink),
596+ );
597+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
598+ throw FirebaseAuthMultiFactorException ._(this , e);
599+ } catch (e) {
600+ rethrow ;
601+ }
577602 }
578603
579604 /// Signs in with an AuthProvider using native authentication flow.
@@ -584,10 +609,16 @@ class FirebaseAuth extends FirebasePluginPlatform {
584609 Future <UserCredential > signInWithAuthProvider (
585610 AuthProvider provider,
586611 ) async {
587- return UserCredential ._(
588- this ,
589- await _delegate.signInWithAuthProvider (provider),
590- );
612+ try {
613+ return UserCredential ._(
614+ this ,
615+ await _delegate.signInWithAuthProvider (provider),
616+ );
617+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
618+ throw FirebaseAuthMultiFactorException ._(this , e);
619+ } catch (e) {
620+ rethrow ;
621+ }
591622 }
592623
593624 /// Starts a sign-in flow for a phone number.
@@ -624,15 +655,27 @@ class FirebaseAuth extends FirebasePluginPlatform {
624655 ///
625656 /// This method is only available on web based platforms.
626657 Future <UserCredential > signInWithPopup (AuthProvider provider) async {
627- return UserCredential ._(this , await _delegate.signInWithPopup (provider));
658+ try {
659+ return UserCredential ._(this , await _delegate.signInWithPopup (provider));
660+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
661+ throw FirebaseAuthMultiFactorException ._(this , e);
662+ } catch (e) {
663+ rethrow ;
664+ }
628665 }
629666
630667 /// Authenticates a Firebase client using a full-page redirect flow.
631668 ///
632669 /// To handle the results and errors for this operation, refer to
633670 /// [getRedirectResult] .
634671 Future <void > signInWithRedirect (AuthProvider provider) {
635- return _delegate.signInWithRedirect (provider);
672+ try {
673+ return _delegate.signInWithRedirect (provider);
674+ } on FirebaseAuthMultiFactorExceptionPlatform catch (e) {
675+ throw FirebaseAuthMultiFactorException ._(this , e);
676+ } catch (e) {
677+ rethrow ;
678+ }
636679 }
637680
638681 /// Signs out the current user.
0 commit comments