firebase-kotlin-sdk icon indicating copy to clipboard operation
firebase-kotlin-sdk copied to clipboard

Authentication error message is different for Android and iOS.

Open solita-michalguspiel opened this issue 3 years ago • 1 comments
trafficstars

Hi! I have an application in which in case of Authentication error I show the prompt what went wrong.

Code in shared module :

fun sendEmailLink() {
        _userAuthState.value = Response.Empty
        settings.putString(CURRENT_EMAIL_KEY, _emailAddressInput.value)
        sharedScope.launch {
            useCases.sendEmailLink.invoke(_emailAddressInput.value).collect { response ->
                if (response == Response.Success(true)) startTimer()
                _sendLinkState.value = response
                println("Printing response in viewmodel : " + response)
                if(response is Response.Error) println("Error message : " + response.message)
            }
        }
    }
What is important in here are the println calls

I couldn't figure out why my iOS app shows such a weird error message, so I added println for debugging and tried to sign in with empty string on each platform

Output on Android :

   I/System.out: Printing response in viewmodel : Error(message=Given String is empty or null)
  I/System.out: Error message : Given String is empty or null

Output on iOS

printing response in viewmodel : Error(message=Error Domain=FIRAuthErrorDomain Code=17034 "An email address must be provided." UserInfo={NSLocalizedDescription=An email address must be provided., FIRAuthErrorUserInfoNameKey=ERROR_MISSING_EMAIL})
Error message : Error Domain=FIRAuthErrorDomain Code=17034 "An email address must be provided." UserInfo={NSLocalizedDescription=An email address must be provided., FIRAuthErrorUserInfoNameKey=ERROR_MISSING_EMAIL}

solita-michalguspiel avatar Jun 08 '22 11:06 solita-michalguspiel

I fixed this in #297. I assume it will be available in the 1.6.2 release

walkingbrad avatar Jul 07 '22 20:07 walkingbrad