File tree 1 file changed +16
-4
lines changed
auth/src/main/java/com/firebase/ui/auth/util/signincontainer
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) {
93
93
}
94
94
95
95
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 ) {
97
110
getDialogHolder ().showLoadingDialog (R .string .fui_progress_dialog_loading );
98
111
99
112
mCredentialsClient = GoogleApiUtils .getCredentialsClient (getActivity ());
100
-
101
113
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 () ]))
104
116
.build ())
105
117
.addOnCompleteListener (this );
106
118
} else {
You can’t perform that action at this time.
0 commit comments