0

I designed an app and the login is with Google (gmail) and I can access normally but when I send the app to for revision through Google play console they send me a creenshot with login error. Sometimes it happens to me but the second tome I try to login it enters well. Is it a Firebase problem or is anything else? Here my code:

fun googleLogin() {
    val providers = arrayListOf(AuthUI.IdpConfig.GoogleBuilder().build())

    btnlogin.setOnClickListener() {
        startActivityForResult(
            AuthUI.getInstance()
                .createSignInIntentBuilder()
                .setAvailableProviders(providers)
                .build(),
            RC_SIGN_IN
        )
    }
}

Thats the firs part which as I said it all works

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)

    if (requestCode == RC_SIGN_IN) {
        val response = IdpResponse.fromResultIntent(data)

        if (resultCode == Activity.RESULT_OK) {
            // Successfully signed in
            val user = FirebaseAuth.getInstance().currentUser
            Toast.makeText(this, "Bienvenid@ ${user!!.displayName}", Toast.LENGTH_SHORT).show()

            startActivity(Intent(this, MainActivity::class.java))
            finish()

        } else {
            Toast.makeText(this, "Error ${response!!.error!!.errorCode}", Toast.LENGTH_SHORT)
                .show()
            // Sign in failed. If response is null the user canceled the
            // sign-in flow using the back button. Otherwise check
            // response.getError().getErrorCode() and handle the error.
            // ...
        }
    }

It shows error 4.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

0 Answers0