Skip to content

Commit 59e6a94

Browse files
authored
Allow setSignInOptions without email scope (#1958)
1 parent bf38de7 commit 59e6a94

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,22 @@ public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) {
11131113
clientId = getApplicationContext().getString(R.string.default_web_client_id);
11141114
}
11151115

1116-
builder.requestEmail().requestIdToken(clientId);
1116+
// Warn the user that they are _probably_ doing the wrong thing if they
1117+
// have not called requestEmail (see issue #1899 and #1621)
1118+
boolean hasEmailScope = false;
1119+
for (Scope s : options.getScopes()) {
1120+
if ("email".equals(s.getScopeUri())) {
1121+
hasEmailScope = true;
1122+
break;
1123+
}
1124+
}
1125+
if (!hasEmailScope) {
1126+
Log.w(TAG, "The GoogleSignInOptions passed to setSignInOptions does not " +
1127+
"request the 'email' scope. In most cases this is a mistake! " +
1128+
"Call requestEmail() on the GoogleSignInOptions object.");
1129+
}
1130+
1131+
builder.requestIdToken(clientId);
11171132
getParams().putParcelable(
11181133
ExtraConstants.GOOGLE_SIGN_IN_OPTIONS, builder.build());
11191134

0 commit comments

Comments
 (0)