Skip to content

FirebaseAuthMultiFactorException not exposing MultiFactorResolver #724

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
RaphaelHx opened this issue May 13, 2025 · 0 comments
Open

FirebaseAuthMultiFactorException not exposing MultiFactorResolver #724

RaphaelHx opened this issue May 13, 2025 · 0 comments

Comments

@RaphaelHx
Copy link

In Firebase, when a user has opted in for TOTP, on signIn, a FirebaseAuthMultiFactorException error is thrown in android and iOS which we expect.
To continue logging in, we need the MultiFactorResolver to resolveSignIn. I see there is the MultiFactor classes defined in this library, but can't fetch the resolver out of the exception in iOS.

https://firebase.google.com/docs/auth/android/totp-mfa#sign_in_users_with_a_second_factor
https://firebase.google.com/docs/auth/ios/totp-mfa#sign_in_users_with_a_second_factor

In android, as the FirebaseAuthMultiFactorException is just a typealias of the google FirebaseAuthMultiFactorException, in the androidMain I can access it like so.

actual fun extractMultiFactorResolver(e: Throwable): MultiFactorResolver? {
    val authException = e as? FirebaseAuthMultiFactorException ?: return null
    return MultiFactorResolver(authException.resolver)
}

However, in iOS, as a whole new error is thrown when this scenario happens (FirebaseAuthMultiFactorException(toString()) with just a toString() of the original error as the message in the new error, how can I acquire the resolver to continue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant