@@ -1066,6 +1066,9 @@ private String getDefaultIso() {
1066
1066
public static final class GoogleBuilder extends Builder {
1067
1067
public GoogleBuilder () {
1068
1068
super (GoogleAuthProvider .PROVIDER_ID );
1069
+ }
1070
+
1071
+ private void validateWebClientId () {
1069
1072
Preconditions .checkConfigured (getApplicationContext (),
1070
1073
"Check your google-services plugin configuration, the" +
1071
1074
" default_web_client_id string wasn't populated." ,
@@ -1103,8 +1106,14 @@ public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) {
1103
1106
ExtraConstants .GOOGLE_SIGN_IN_OPTIONS );
1104
1107
1105
1108
GoogleSignInOptions .Builder builder = new GoogleSignInOptions .Builder (options );
1106
- builder .requestEmail ().requestIdToken (getApplicationContext ()
1107
- .getString (R .string .default_web_client_id ));
1109
+
1110
+ String clientId = options .getServerClientId ();
1111
+ if (clientId == null ) {
1112
+ validateWebClientId ();
1113
+ clientId = getApplicationContext ().getString (R .string .default_web_client_id );
1114
+ }
1115
+
1116
+ builder .requestEmail ().requestIdToken (clientId );
1108
1117
getParams ().putParcelable (
1109
1118
ExtraConstants .GOOGLE_SIGN_IN_OPTIONS , builder .build ());
1110
1119
@@ -1115,6 +1124,7 @@ public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) {
1115
1124
@ Override
1116
1125
public IdpConfig build () {
1117
1126
if (!getParams ().containsKey (ExtraConstants .GOOGLE_SIGN_IN_OPTIONS )) {
1127
+ validateWebClientId ();
1118
1128
setScopes (Collections .<String >emptyList ());
1119
1129
}
1120
1130
0 commit comments