fix: Unable to acquire impersonated credentials

Merge https://github.com/google/adk-python/pull/2003

add scope "https://www.googleapis.com/auth/cloud-platform" within google.auth.default

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2003 from hsuyuming:fix/issue_2001_support_impersonated_credential 8874a367273aca98460f7f250bfc4690f883ebbe
PiperOrigin-RevId: 788656025
This commit is contained in:
hsuyuming
2025-07-29 16:42:25 -07:00
committed by Copybara-Service
parent de6ebddcd2
commit 9db5d9a3e8
10 changed files with 238 additions and 8 deletions
@@ -125,7 +125,10 @@ def test_exchange_credential_use_default_credential_success(
assert result.auth_type == AuthCredentialTypes.HTTP
assert result.http.scheme == "bearer"
assert result.http.credentials.token == "mock_access_token"
mock_google_auth_default.assert_called_once()
# Verify google.auth.default is called with the correct scopes parameter
mock_google_auth_default.assert_called_once_with(
scopes=["https://www.googleapis.com/auth/cloud-platform"]
)
mock_credentials.refresh.assert_called_once()