You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys! Thanks for the constellation of KMP compatible firebase libraries!
I've started my migration with firebase-auth and found out that FirebaseAuthException.errorCode(s) are omitted.
It would be nice to have the errorCodes along with the error messages. Thanks!
The text was updated successfully, but these errors were encountered:
AlexeySAntonov
changed the title
Add [FirebaseAuthException].[errorCode] to [firebase-auth] for [iOS/Android/...]
Add FirebaseAuthException.errorCode to "firebase-auth" for iOS/Android/...
Nov 18, 2024
suspend fun signInWithEmail(email: String, password: String): FirebaseSignInResult {
return try {
val result = auth.signInWithEmailAndPassword(email, password)
FirebaseSignInResult.Success
} catch (e: Exception) {
handleFailure(e)
}
}
private fun handleFailure(e: Exception): FirebaseSignInResult {
return when (e) {
is FirebaseAuthWeakPasswordException -> FirebaseSignInResult.Failure.WeakPassword
is FirebaseAuthInvalidCredentialsException -> handleInvalidCredentialsFailure(e)
is FirebaseAuthInvalidUserException -> handleInvalidUserFailure(e)
is FirebaseAuthUserCollisionException -> FirebaseSignInResult.Failure.UserCollision
is FirebaseAuthEmailException -> FirebaseSignInResult.Failure.InvalidEmail
else -> FirebaseSignInResult.Failure.Unexpected
}
}
sealed interface FirebaseSignInResult {
data object Success : FirebaseSignInResult
sealed interface Failure : FirebaseSignInResult {
data object InvalidPassword : Failure
data object InvalidEmail : Failure
data object WeakPassword : Failure
data object UserDisabled : Failure
data object UserNotFound : Failure
data object UserCollision : Failure
data object Unexpected : Failure
}
}
Hey guys! Thanks for the constellation of KMP compatible firebase libraries!
I've started my migration with firebase-auth and found out that FirebaseAuthException.errorCode(s) are omitted.
It would be nice to have the errorCodes along with the error messages. Thanks!
The text was updated successfully, but these errors were encountered: