diff --git a/core/src/main/java/com/google/cloud/sql/core/CloudSqlInstance.java b/core/src/main/java/com/google/cloud/sql/core/CloudSqlInstance.java index 080821781..81f3c677b 100644 --- a/core/src/main/java/com/google/cloud/sql/core/CloudSqlInstance.java +++ b/core/src/main/java/com/google/cloud/sql/core/CloudSqlInstance.java @@ -527,7 +527,9 @@ private Certificate fetchEphemeralCertificate(KeyPair keyPair) { if (enableIamAuth) { try { - GoogleCredentials downscoped = getDownscopedCredentials(credentials.get()); + OAuth2Credentials creds = credentials.get(); + creds.refresh(); + GoogleCredentials downscoped = getDownscopedCredentials(creds); downscoped.refresh(); String token = downscoped.getAccessToken().getTokenValue(); // TODO: remove this once issue with OAuth2 Tokens is resolved.