Skip to content

Commit fb053de

Browse files
authored
Revert "Refresh the OAuth credentials proactively (#483)" (#506)
This reverts commit 352f259. Change-Id: Ia0f0de1aaeb41faf6633c253c6f07b4317d97b8b
1 parent 2b396c3 commit fb053de

2 files changed

Lines changed: 0 additions & 43 deletions

File tree

google-ads/src/main/java/com/google/ads/googleads/lib/GoogleAdsClient.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.api.gax.rpc.TransportChannelProvider;
2323
import com.google.auth.Credentials;
2424
import com.google.auth.oauth2.GoogleCredentials;
25-
import com.google.auth.oauth2.OAuth2Credentials;
2625
import com.google.auth.oauth2.ServiceAccountCredentials;
2726
import com.google.auth.oauth2.UserCredentials;
2827
import com.google.auto.value.AutoValue;
@@ -549,10 +548,6 @@ public GoogleAdsClient build() {
549548
// action is needed.
550549
}
551550

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-
556551
// Provides the credentials to the primer to preemptively get these ready for usage.
557552
Primer.getInstance().ifPresent(p -> p.primeCredentialsAsync(getCredentials()));
558553
// Proceeds with creating the client library instance.
@@ -581,19 +576,6 @@ public GoogleAdsClient build() {
581576
return provider;
582577
}
583578

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-
597579
@VisibleForTesting
598580
Builder setConfigurationFileSupplier(Supplier<File> configurationFileSupplier) {
599581
this.configurationFileSupplier = configurationFileSupplier;

google-ads/src/main/java/com/google/ads/googleads/lib/OAuthException.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)