镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
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

Closed

Description

@mfriedy

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

It seems this commit changed the refresh logic of impersonated account credentials at exactly this line: 36ecb1d#diff-9fb6744f480c88b7964f845792d2d930c9a7048caee2ba4931dc2c899c623cb6L289

Reverting back to 2.41.1 fixes it.

Python: 3.13.9

Activity

  1. jmesterh commented on Oct 30, 2025

    @jmesterh

    Also seeing this please fix ASAP

  2. capitantoto commented on Oct 30, 2025

    @capitantoto

    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:

    • a single config like this:
    % gcloud config list
    [auth]
    impersonate_service_account = service-account@myproject.iam.gserviceaccount.com
    [core]
    account = gonzalo@company.com
    disable_usage_reporting = False
    project = myproject
    

    which is authenticated via

    gcloud auth application-default login
    

    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

  3. GeeekyBoy commented on Oct 31, 2025

    @GeeekyBoy

    We're facing a similar problem too!

  4. drewgillson commented on Oct 31, 2025

    @drewgillson

    This is a blocker for us

  5. neurowelt commented on Nov 10, 2025

    @neurowelt

    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.

  6. agentbrain commented on Nov 11, 2025

    @agentbrain

    also confirming this has been broken for us since the 2.42.0 release and pinning to 2.41.1 resolves the issue

  7. camilleAmaury commented on Nov 12, 2025

    @camilleAmaury

    +1, quite blocking with any services which needs to refresh the credentials.

  8. wwangsa commented on Nov 12, 2025

    @wwangsa

    +1

  9. kranthibandaru commented on Nov 12, 2025

    @kranthibandaru

    We have the same issue as well. Please fix it at the earliest.

  10. mikeedjones commented on Nov 20, 2025

    @mikeedjones

    problem is is with either of these two PRs:
    https://github.com/googleapis/google-auth-library-python/pull/1809/files

    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.

  11. spkgyk commented on Nov 20, 2025

    @spkgyk

    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

  12. added a commit that references this issue on Nov 23, 2025
    a283a5b
  13. mathewswoolies commented on Dec 1, 2025

    @mathewswoolies

    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

  14. jmesterh commented on Dec 1, 2025

    @jmesterh

    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?

  15. sebastian-correa commented on Dec 2, 2025

    @sebastian-correa

    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:

  16. iostreamdoth commented on Dec 4, 2025

    @iostreamdoth

    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)
    
  17. mikeedjones commented on Dec 4, 2025

    @mikeedjones

    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.

  18. iostreamdoth commented on Dec 4, 2025

    @iostreamdoth

    I m more concerned that even though a PR #1875 was created there is no review on it from past 2 weeks.

  19. onur-lh commented on Dec 5, 2025

    @onur-lh

    Are googlers left for the remainder of the year? Why is this not fixed yet?

  20. mfriedy commented on Dec 9, 2025

    @mfriedy
    Author

    It seems there might be some movement? #1884

    (sadly the PR didn't ref this issue)

  21. SuryaTejaSusarla commented on Dec 30, 2025

    @SuryaTejaSusarla

    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:

    1. Create a minimal reproduction script that forces a token expiry on the source credential to see if it propagates the error correctly.

    2. 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.

  22. mfriedy commented on Dec 30, 2025

    @mfriedy
    Author

    This was fixed in 2.44 it seems

  23. mikeedjones commented on Jan 30, 2026

    @mikeedjones

    fixed by #1884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions