Skip to content

[2.42.0] Bug with impersonated account token refresh #1850

@mfriedy

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

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