我可以更改 Firebase Auth UI 的身份验证流程吗?

Can I change the Authentication Flow of Firebase Auth UI?

根据 Firebase documentation:如果用户输入一个不存在的电子邮件地址,流程会将用户带到注册部分。在我的应用程序中将没有注册部分。如何跳过注册部分并将用户重定向到登录屏幕?

代码如下:

 // Choose authentication providers
    List<AuthUI.IdpConfig> providers = Arrays.asList(
            new AuthUI.IdpConfig.EmailBuilder().build());

    // Create and launch sign-in intent
    startActivityForResult(
            AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setAvailableProviders(providers)
                    .build(),
            RC_SIGN_IN);
}



@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {


    super.onActivityResult(requestCode, resultCode, data);
    // RC_SIGN_IN is the request code you passed into startActivityForResult(...) when starting the sign in flow.
    if (requestCode == RC_SIGN_IN) {
        IdpResponse response = IdpResponse.fromResultIntent(data);

        // Successfully signed in
        if (resultCode == RESULT_OK) {
            //startActivity(SignedInActivity.createIntent(this, response));
            finish();
        }
        else {

            // Sign in failed
            if (response == null) {


            }

            if (response.getError().getErrorCode() == ErrorCodes.NO_NETWORK) {
                Toast.makeText(this, "No Connection." , Toast.LENGTH_SHORT).show();
                return;
            }
        }

    }

}

是的,这是可能的:使用 setAllowNewAccounts。 (看来我们忘记添加文档了,抱歉。)

完整示例:

new AuthUI.IdpConfig.EmailBuilder()
    .setAllowNewAccounts(false)
    .build()