You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
[2.42.0] Bug with impersonated account token refresh #1850
After updating from 2.41.1 to 2.42.0 I get this issue:
File "C:\...\.venv\Lib\site-packages\google\auth\transport\requests.py", line 535, in request
self.credentials.before_request(auth_request, method, url, request_headers)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\...\.venv\Lib\site-packages\google\auth\credentials.py", line 228, in before_request
self._blocking_refresh(request)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\...\.venv\Lib\site-packages\google\auth\credentials.py", line 191, in _blocking_refresh
self.refresh(request)
~~~~~~~~~~~~^^^^^^^^^
File "C:\...\.venv\Lib\site-packages\google\auth\credentials.py", line 365, in refresh
self._refresh_token(request)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "C:\...\.venv\Lib\site-packages\google\auth\impersonated_credentials.py", line 289, in _refresh_token
self._source_credentials._refresh_token(request)
TypeError: 'str' object is not callable
Reacted by Franz B., lorrandalx, Nicolas Munsch, Marin, Sunil Krishnan, Ahmed Hassan, Antonio Martins, Gonzalo Barrera Borla, thibault-tiro, Justus Voigt and 83 more
Reacted by Cesar Merjan
Reacted by Franz B., lorrandalx, rodrigoalmeidaee, Kamil, Kenta Murata and Calum Crawford
Yes! It took me forever to debug this issue because we updated google-auth as part of a much large upgrade, but in the end it came down to the move from 2.41.1 to 2.42.0, and it's still broken with 2.42.1 from earlier today.
Minimum reproducible environment (in development) for me has:
And a pyproject.toml with a single unpinned dependency, google-cloud-bigquery managed by uv. With that environment uv solves to 3.38.0 for bigquery and 2.42.1 for google-auth. In that scenario, this test command:
uv run python -c "from google.cloud import bigquery; list(ds.dataset_id for ds in bigquery.Client().list_datasets())"
returns the str not callable error:
File "/Users/gonzalo/Git/goog6/.venv/lib/python3.11/site-packages/google/auth/impersonated_credentials.py", line 289, in _refresh_token
self._source_credentials._refresh_token(request)
TypeError: 'str' object is not callable
If I add a constraint on google_auth <2.42, it gets solved to 2.41.1 and the same test command runs and exits without errors.
For completeness'sake, here's the pyproject.toml from the example that returns the str not callable error:
[project]
name = "goog6"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"google-auth>=2.42",
"google-cloud-bigquery==3.38.0",
]
I ran it with Python 3.11.13
Reacted by Ahmed Hassan, Sunil Krishnan, Franz B. and 1 more
Confirming that pinning google-auth==2.41.1 resolved the issue for me (needed it for google-cloud-texttospeech==2.31.0 service). Checked on Python 3.13.5.
Yes, It looks like in #1809 the Credentials subclasses in google.auth where updated to change _refresh_token -> _refresh_token_val and change refresh_token from an attribute to a method. The corresponding change in google.oath2 were not implemented and the test has that attribute mocked so i guess was missed in testing.
Still an issue with google-auth 2.43.0 breaks impersonated credentials, causing TypeError: 'str' object is not callable. Downgrading to 2.41.1 for now.
venv\Lib\site-packages\google\auth\impersonated_credentials.py", line 289, in _refresh_token
self._source_credentials._refresh_token(request)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: 'str' object is not callable
This is blocking us as well and it seems like a big issue overall with a simple fix. I hate to do this, but I'm tagging a couple of people that could be maintainers (as determined by their contribution ranking) to see if we can get this fix merged:
Well, I think there is a mix up with google.auth.impersonated_credentials.Credentials and google.oauth2.credentials.Credentials classes. I think the fix should be just this.
if isinstance(self._source_credentials, credentials.CredentialsWithTrustBoundary):
self._source_credentials._refresh_token(request)
else:
self._source_credentials.refresh(request)
I think that should work, but before #1809 those interfaces were the same. I think the fix should be to align the interfaces once again (#1875). Looking at the tests, that does seem to be the intended behaviour, but the mocking means it was missed.
I've been following this thread. Coming from an enterprise environment where we rely heavily on ImpersonatedCredentials via Vault (short-lived source credentials), I suspect the issue might be in how the refresh method handles the underlying source_credentials expiry state before attempting the IAMCredentials API call.
I am planning to investigate this over the weekend.
My goal is to:
Create a minimal reproduction script that forces a token expiry on the source credential to see if it propagates the error correctly.
If confirmed, submit a PR to ensure the source is refreshed upstream before the impersonation call.
If anyone has a reproduction script that is already working/failing consistently, please share it to speed this up.
Activity
jmesterh commentedon Oct 30, 2025
Also seeing this please fix ASAP
capitantoto commentedon Oct 30, 2025
Yes! It took me forever to debug this issue because we updated
google-authas part of a much large upgrade, but in the end it came down to the move from2.41.1to2.42.0, and it's still broken with2.42.1from earlier today.Minimum reproducible environment (in development) for me has:
which is authenticated via
And a pyproject.toml with a single unpinned dependency,
google-cloud-bigquerymanaged byuv. With that environmentuvsolves to3.38.0for bigquery and2.42.1forgoogle-auth. In that scenario, this test command:returns the
str not callableerror:If I add a constraint on
google_auth <2.42, it gets solved to2.41.1and the same test command runs and exits without errors.For completeness'sake, here's the
pyproject.tomlfrom the example that returns thestr not callableerror:I ran it with Python 3.11.13
GeeekyBoy commentedon Oct 31, 2025
We're facing a similar problem too!
Sylver11 commentedon Oct 31, 2025
problem is is with either of these two PRs:
https://github.com/googleapis/google-auth-library-python/pull/1820/files
https://github.com/googleapis/google-auth-library-python/pull/1809/files
drewgillson commentedon Oct 31, 2025
This is a blocker for us
neurowelt commentedon Nov 10, 2025
Confirming that pinning
google-auth==2.41.1resolved the issue for me (needed it forgoogle-cloud-texttospeech==2.31.0service). Checked on Python 3.13.5.agentbrain commentedon Nov 11, 2025
also confirming this has been broken for us since the 2.42.0 release and pinning to 2.41.1 resolves the issue
camilleAmaury commentedon Nov 12, 2025
+1, quite blocking with any services which needs to refresh the credentials.
wwangsa commentedon Nov 12, 2025
+1
kranthibandaru commentedon Nov 12, 2025
We have the same issue as well. Please fix it at the earliest.
mikeedjones commentedon Nov 20, 2025
Yes, It looks like in #1809 the
Credentialssubclasses ingoogle.authwhere updated to change_refresh_token->_refresh_token_valand changerefresh_tokenfrom an attribute to a method. The corresponding change ingoogle.oath2were not implemented and the test has that attribute mocked so i guess was missed in testing.spkgyk commentedon Nov 20, 2025
Can confirm that it's an issue in python 3.12.11 as well as 3.13.x. Similarly, downgrading to 2.41.1 resolves the issue
fix: rename internal refresh token attribute to _refresh_token_val an…
mathewswoolies commentedon Dec 1, 2025
Still an issue with google-auth 2.43.0 breaks impersonated credentials, causing TypeError: 'str' object is not callable. Downgrading to 2.41.1 for now.
venv\Lib\site-packages\google\auth\impersonated_credentials.py", line 289, in _refresh_token
self._source_credentials._refresh_token(request)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: 'str' object is not callable
jmesterh commentedon Dec 1, 2025
How is it that this bug in a core auth library has existed for over a month with no response? Is impersonation really that unpopular?
sebastian-correa commentedon Dec 2, 2025
This is blocking us as well and it seems like a big issue overall with a simple fix. I hate to do this, but I'm tagging a couple of people that could be maintainers (as determined by their contribution ranking) to see if we can get this fix merged:
iostreamdoth commentedon Dec 4, 2025
Well, I think there is a mix up with
google.auth.impersonated_credentials.Credentialsandgoogle.oauth2.credentials.Credentialsclasses. I think the fix should be just this.mikeedjones commentedon Dec 4, 2025
I think that should work, but before #1809 those interfaces were the same. I think the fix should be to align the interfaces once again (#1875). Looking at the tests, that does seem to be the intended behaviour, but the mocking means it was missed.
iostreamdoth commentedon Dec 4, 2025
I m more concerned that even though a PR #1875 was created there is no review on it from past 2 weeks.
onur-lh commentedon Dec 5, 2025
Are googlers left for the remainder of the year? Why is this not fixed yet?
mfriedy commentedon Dec 9, 2025
It seems there might be some movement? #1884
(sadly the PR didn't ref this issue)
SuryaTejaSusarla commentedon Dec 30, 2025
Hi all,
I've been following this thread. Coming from an enterprise environment where we rely heavily on ImpersonatedCredentials via Vault (short-lived source credentials), I suspect the issue might be in how the refresh method handles the underlying source_credentials expiry state before attempting the IAMCredentials API call.
I am planning to investigate this over the weekend.
My goal is to:
Create a minimal reproduction script that forces a token expiry on the source credential to see if it propagates the error correctly.
If confirmed, submit a PR to ensure the source is refreshed upstream before the impersonation call.
If anyone has a reproduction script that is already working/failing consistently, please share it to speed this up.
mfriedy commentedon Dec 30, 2025
This was fixed in 2.44 it seems
mikeedjones commentedon Jan 30, 2026
fixed by #1884