Fireabse UI sign up without requesting user name

笑着哭i 提交于 2021-02-04 08:30:45

问题


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(...


回答1:


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

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


来源:https://stackoverflow.com/questions/62135803/fireabse-ui-sign-up-without-requesting-user-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!