Search code examples
androidfirebasefirebase-authenticationfirebaseui

Fireabse UI sign up without requesting user name


Using Firebase UI for sign-in and sign-up, how do I remove the option for a user to sign-up with a first & last name? In other words, only their email and password are required.

According to this github issue, the feature to do so has been implemented.

Firebase provided Kotlin code for sign-in/sign-up:

private fun createSignInIntent() {
    // Choose authentication providers
    val providers = arrayListOf(
        AuthUI.IdpConfig.EmailBuilder().build(),
        AuthUI.IdpConfig.GoogleBuilder().build())

    // Create and launch sign-in intent
    startActivityForResult(
        AuthUI.getInstance()
            .createSignInIntentBuilder()
            .setAvailableProviders(providers)
            .setLogo(R.drawable.logo)
            .setTheme(R.style.AppTheme)
            .build(),
        RC_SIGN_IN)
}

override fun onActivityResult(...

enter image description here


Solution

  • The pull request that implements this feature suggests that you call setRequireName(false) on your EmailBuilder object.

    AuthUI.IdpConfig.EmailBuilder().setRequireName(false).build()