firebase-kotlin-sdk
firebase-kotlin-sdk copied to clipboard
FirebaseAuthMultiFactorException not exposing MultiFactorResolver
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?