diff --git a/CHANGELOG.md b/CHANGELOG.md index db4f1a58b..a9880be63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ [1]: https://pypi.org/project/google-auth/#history +## [2.40.3](https://github.com/googleapis/google-auth-library-python/compare/v2.40.2...v2.40.3) (2025-06-04) + + +### Bug Fixes + +* Auth fetch token from default endpoint ([#1779](https://github.com/googleapis/google-auth-library-python/issues/1779)) ([88891cc](https://github.com/googleapis/google-auth-library-python/commit/88891cc596640b0bb3a2891532e2d32f2c9f0ec3)) +* Remove unnecessary call to mds service ([#1769](https://github.com/googleapis/google-auth-library-python/issues/1769)) ([7c61c7d](https://github.com/googleapis/google-auth-library-python/commit/7c61c7d0a42ceec3eab693065745a74f524acab0)) +* Retry 504 errors ([#1767](https://github.com/googleapis/google-auth-library-python/issues/1767)) ([554f967](https://github.com/googleapis/google-auth-library-python/commit/554f967620da2b02e5d44ac7463dcc2407ace5dd)) + ## [2.40.2](https://github.com/googleapis/google-auth-library-python/compare/v2.40.1...v2.40.2) (2025-05-21) diff --git a/google/auth/compute_engine/credentials.py b/google/auth/compute_engine/credentials.py index f0126c0a8..eb50d288b 100644 --- a/google/auth/compute_engine/credentials.py +++ b/google/auth/compute_engine/credentials.py @@ -124,8 +124,9 @@ def refresh(self, request): scopes = self._scopes if self._scopes is not None else self._default_scopes try: self._retrieve_info(request) + # Always fetch token with default service account email. self.token, self.expiry = _metadata.get_service_account_token( - request, service_account=self._service_account_email, scopes=scopes + request, service_account="default", scopes=scopes ) except exceptions.TransportError as caught_exc: new_exc = exceptions.RefreshError(caught_exc) diff --git a/google/auth/transport/__init__.py b/google/auth/transport/__init__.py index 724568e58..457576350 100644 --- a/google/auth/transport/__init__.py +++ b/google/auth/transport/__init__.py @@ -30,6 +30,7 @@ DEFAULT_RETRYABLE_STATUS_CODES = ( http_client.INTERNAL_SERVER_ERROR, http_client.SERVICE_UNAVAILABLE, + http_client.GATEWAY_TIMEOUT, http_client.REQUEST_TIMEOUT, http_client.TOO_MANY_REQUESTS, ) diff --git a/google/auth/version.py b/google/auth/version.py index 13257b95f..318bf723b 100644 --- a/google/auth/version.py +++ b/google/auth/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.40.2" +__version__ = "2.40.3" diff --git a/system_tests/secrets.tar.enc b/system_tests/secrets.tar.enc index f54c3f987..4e56a6404 100644 Binary files a/system_tests/secrets.tar.enc and b/system_tests/secrets.tar.enc differ diff --git a/tests/compute_engine/test_credentials.py b/tests/compute_engine/test_credentials.py index fddfb7f64..03fe845b1 100644 --- a/tests/compute_engine/test_credentials.py +++ b/tests/compute_engine/test_credentials.py @@ -501,7 +501,7 @@ def test_with_target_audience_integration(self): responses.add( responses.GET, "http://metadata.google.internal/computeMetadata/v1/instance/" - "service-accounts/service-account@example.com/token", + "service-accounts/default/token", status=200, content_type="application/json", json={ @@ -659,7 +659,7 @@ def test_with_quota_project_integration(self): responses.add( responses.GET, "http://metadata.google.internal/computeMetadata/v1/instance/" - "service-accounts/service-account@example.com/token", + "service-accounts/default/token", status=200, content_type="application/json", json={