diff --git a/gax/src/main/java/com/google/api/gax/rpc/StubSettings.java b/gax/src/main/java/com/google/api/gax/rpc/StubSettings.java index b22f6a451..1b6090107 100644 --- a/gax/src/main/java/com/google/api/gax/rpc/StubSettings.java +++ b/gax/src/main/java/com/google/api/gax/rpc/StubSettings.java @@ -41,7 +41,6 @@ import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.tracing.ApiTracerFactory; import com.google.api.gax.tracing.NoopApiTracerFactory; -import com.google.auth.Credentials; import com.google.auth.oauth2.QuotaProjectIdProvider; import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; @@ -266,14 +265,6 @@ public B setExecutorProvider(ExecutorProvider executorProvider) { /** Sets the CredentialsProvider to use for getting the credentials to make calls with. */ public B setCredentialsProvider(CredentialsProvider credentialsProvider) { this.credentialsProvider = Preconditions.checkNotNull(credentialsProvider); - try { - Credentials credentials = credentialsProvider.getCredentials(); - if (this.quotaProjectId == null && credentials instanceof QuotaProjectIdProvider) { - this.quotaProjectId = ((QuotaProjectIdProvider) credentials).getQuotaProjectId(); - } - } catch (IOException e) { - System.out.println("fail to fetch credentials"); - } return self(); } diff --git a/gax/src/test/java/com/google/api/gax/rpc/ClientSettingsTest.java b/gax/src/test/java/com/google/api/gax/rpc/ClientSettingsTest.java index cf842a923..d777f506a 100644 --- a/gax/src/test/java/com/google/api/gax/rpc/ClientSettingsTest.java +++ b/gax/src/test/java/com/google/api/gax/rpc/ClientSettingsTest.java @@ -420,8 +420,6 @@ public Credentials getCredentials() throws IOException { .isEqualTo(QUOTA_PROJECT_ID_FROM_INTERNAL_HEADER_VALUE); Truth.assertThat(builder_setQuotaFromInternalHeadersAndBuilders.getQuotaProjectId()) .isEqualTo(QUOTA_PROJECT_ID_FROM_BUILDERS); - Truth.assertThat(builder_setQuotaFromCredentialsProvider.getQuotaProjectId()) - .isEqualTo(QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE); Truth.assertThat(builder_setQuotaFromCredentialsProviderAndBuilder.getQuotaProjectId()) .isEqualTo(QUOTA_PROJECT_ID_FROM_BUILDERS); Truth.assertThat(builder_setQuotaFromAllSources.getQuotaProjectId())