diff --git a/packages/gcp-sphinx-docfx-yaml/tests/testdata/auth/google_auth_oauthlib/helpers.py b/packages/gcp-sphinx-docfx-yaml/tests/testdata/auth/google_auth_oauthlib/helpers.py index 48a39121429b..7da50d7e1218 100644 --- a/packages/gcp-sphinx-docfx-yaml/tests/testdata/auth/google_auth_oauthlib/helpers.py +++ b/packages/gcp-sphinx-docfx-yaml/tests/testdata/auth/google_auth_oauthlib/helpers.py @@ -147,5 +147,7 @@ def credentials_from_session(session, client_config=None): scopes=session.scope, granted_scopes=session.token.get("scope"), ) - credentials.expiry = datetime.datetime.utcfromtimestamp(session.token["expires_at"]) + credentials.expiry = datetime.datetime.fromtimestamp( + session.token["expires_at"], datetime.timezone.utc + ).replace(tzinfo=None) return credentials diff --git a/packages/google-auth-oauthlib/google_auth_oauthlib/helpers.py b/packages/google-auth-oauthlib/google_auth_oauthlib/helpers.py index 25462f4c193c..663c1c9832bf 100644 --- a/packages/google-auth-oauthlib/google_auth_oauthlib/helpers.py +++ b/packages/google-auth-oauthlib/google_auth_oauthlib/helpers.py @@ -147,5 +147,7 @@ def credentials_from_session(session, client_config=None): scopes=session.scope, granted_scopes=session.token.get("scope"), ) - credentials.expiry = datetime.datetime.utcfromtimestamp(session.token["expires_at"]) + credentials.expiry = datetime.datetime.fromtimestamp( + session.token["expires_at"], datetime.timezone.utc + ).replace(tzinfo=None) return credentials