File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
auth/src/main/java/com/firebase/ui/auth/util/signincontainer Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -93,14 +93,26 @@ public void onCreate(Bundle savedInstance) {
9393 }
9494
9595 FlowParameters flowParams = getFlowParams ();
96- if (flowParams .enableCredentials ) {
96+
97+ // Only support password credentials if email auth is enabled
98+ boolean supportPasswords = false ;
99+ for (AuthUI .IdpConfig config : flowParams .providerInfo ) {
100+ if (EmailAuthProvider .PROVIDER_ID .equals (config .getProviderId ())) {
101+ supportPasswords = true ;
102+ }
103+ }
104+ List <String > accountTypes = getSupportedAccountTypes ();
105+
106+ // If the request will be empty, avoid the step entirely
107+ boolean willRequestCredentials = supportPasswords || accountTypes .size () > 0 ;
108+
109+ if (flowParams .enableCredentials && willRequestCredentials ) {
97110 getDialogHolder ().showLoadingDialog (R .string .fui_progress_dialog_loading );
98111
99112 mCredentialsClient = GoogleApiUtils .getCredentialsClient (getActivity ());
100-
101113 mCredentialsClient .request (new CredentialRequest .Builder ()
102- .setPasswordLoginSupported (true )
103- .setAccountTypes (getSupportedAccountTypes () .toArray (new String [0 ]))
114+ .setPasswordLoginSupported (supportPasswords )
115+ .setAccountTypes (accountTypes .toArray (new String [accountTypes . size () ]))
104116 .build ())
105117 .addOnCompleteListener (this );
106118 } else {
You can’t perform that action at this time.
0 commit comments