|
22 | 22 | import com.google.api.gax.rpc.TransportChannelProvider; |
23 | 23 | import com.google.auth.Credentials; |
24 | 24 | import com.google.auth.oauth2.GoogleCredentials; |
25 | | -import com.google.auth.oauth2.OAuth2Credentials; |
26 | 25 | import com.google.auth.oauth2.ServiceAccountCredentials; |
27 | 26 | import com.google.auth.oauth2.UserCredentials; |
28 | 27 | import com.google.auto.value.AutoValue; |
@@ -549,10 +548,6 @@ public GoogleAdsClient build() { |
549 | 548 | // action is needed. |
550 | 549 | } |
551 | 550 |
|
552 | | - // Refreshes the OAuth credentials if necessary. This also ensures that the credentials are |
553 | | - // valid, avoiding https://github.com/googleads/google-ads-java/issues/169 |
554 | | - refreshCredentialsIfNecessary(); |
555 | | - |
556 | 551 | // Provides the credentials to the primer to preemptively get these ready for usage. |
557 | 552 | Primer.getInstance().ifPresent(p -> p.primeCredentialsAsync(getCredentials())); |
558 | 553 | // Proceeds with creating the client library instance. |
@@ -581,19 +576,6 @@ public GoogleAdsClient build() { |
581 | 576 | return provider; |
582 | 577 | } |
583 | 578 |
|
584 | | - /** Attempts to refresh the OAuth credentials if necessary. */ |
585 | | - private void refreshCredentialsIfNecessary() { |
586 | | - Credentials credentials = getCredentials(); |
587 | | - if (credentials instanceof OAuth2Credentials) { |
588 | | - OAuth2Credentials oAuth2Credentials = (OAuth2Credentials) credentials; |
589 | | - try { |
590 | | - oAuth2Credentials.refreshIfExpired(); |
591 | | - } catch (IOException e) { |
592 | | - throw new OAuthException(e); |
593 | | - } |
594 | | - } |
595 | | - } |
596 | | - |
597 | 579 | @VisibleForTesting |
598 | 580 | Builder setConfigurationFileSupplier(Supplier<File> configurationFileSupplier) { |
599 | 581 | this.configurationFileSupplier = configurationFileSupplier; |
|
0 commit comments