According to the Firebase documentation: If a user enters a non-existing email address, the flow takes the user to the sign-up part. In my app there will be no signing-up section. How can I skip sign-up part and redirect user to the sign in screen?
here is the code:
// 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;
}
}
}
}
Yes, this is possible: use setAllowNewAccounts
. (Looks like we forgot to add docs, sorry about that.)
Full example:
new AuthUI.IdpConfig.EmailBuilder()
.setAllowNewAccounts(false)
.build()