@@ -1066,6 +1066,9 @@ private String getDefaultIso() {
10661066 public static final class GoogleBuilder extends Builder {
10671067 public GoogleBuilder () {
10681068 super (GoogleAuthProvider .PROVIDER_ID );
1069+ }
1070+
1071+ private void validateWebClientId () {
10691072 Preconditions .checkConfigured (getApplicationContext (),
10701073 "Check your google-services plugin configuration, the" +
10711074 " default_web_client_id string wasn't populated." ,
@@ -1103,8 +1106,14 @@ public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) {
11031106 ExtraConstants .GOOGLE_SIGN_IN_OPTIONS );
11041107
11051108 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 );
11081117 getParams ().putParcelable (
11091118 ExtraConstants .GOOGLE_SIGN_IN_OPTIONS , builder .build ());
11101119
@@ -1115,6 +1124,7 @@ public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) {
11151124 @ Override
11161125 public IdpConfig build () {
11171126 if (!getParams ().containsKey (ExtraConstants .GOOGLE_SIGN_IN_OPTIONS )) {
1127+ validateWebClientId ();
11181128 setScopes (Collections .<String >emptyList ());
11191129 }
11201130
0 commit comments