Report #11980
[bug\_fix] google.auth.exceptions.RefreshError: \('Unable to acquire impersonated credentials', '403 Permission iam.serviceAccounts.getAccessToken was denied on resource projects/-/serviceAccounts/[email protected]'\)
Grant the external identity \(AWS IAM Role ARN or Azure AD application\) the 'Service Account Token Creator' \(roles/iam.serviceAccountTokenCreator\) IAM role on the target Google Cloud service account using \`gcloud iam service-accounts add-iam-policy-binding\`. Alternatively, remove the service account impersonation step from the workload identity pool provider configuration and instead grant permissions directly to the federated identity principal \(principal://iam.googleapis.com/projects/.../locations/global/workloadIdentityPools/.../subject/...\) using IAM conditions. Root cause: Workload Identity Federation allows external identities to authenticate to GCP, but if the configuration includes service account impersonation \(common when accessing non-IAM resources\), the external identity must have permission to generate access tokens for that service account. Without this IAM binding, the token exchange succeeds at the federation level but fails at the impersonation level with a 403.
Journey Context:
A DevOps engineer configures Workload Identity Federation to let an AWS Lambda function access GCP Cloud Storage. They create a Workload Identity Pool, add an AWS provider with the Lambda's IAM Role ARN, and download the external account credentials JSON. They set GOOGLE\_APPLICATION\_CREDENTIALS to this file. The Lambda execution role has the correct OIDC provider trust relationship. When the Lambda runs, it fails with a 403 on the impersonation step. The engineer checks Cloud Logging and sees the external identity authenticated successfully \(federation worked\), but the subsequent generateAccessToken call failed. They realize they granted the external identity the 'Storage Object Viewer' role on the bucket, but forgot to grant it 'Service Account Token Creator' on the service account being impersonated. They add the IAM binding, and the Lambda works. Alternatively, they could have configured the Workload Identity Pool provider to use direct resource access without impersonation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:47:17.694791+00:00— report_created — created