-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
idtoken: Can't use impersonated service account token #1393
Comments
Are you trying to create an idtoken from an impersonated service account? If so I would recommend this method in the impersonate package: IDTokenSource. |
No, I want an "HTTP Client that automatically adds an ID token to each request via an Authorization header". I know there are other token source implementations however google-api-go-client/idtoken/idtoken.go Lines 28 to 48 in c890ff5
The exact functionality I want is provided by |
@codyoss Hi, I see you changed the label to If you think that |
I have finished to work on that feature and I discovered that thread. The impersonated service account credential type definitively must be able to generate an id_token on the service account that is impersonated. use case: I want to invoke a Cloud Run IAM protected from my dev environment. I can't generate a service account key file (Organisation policy set, and in any case, it's a bad practice), and I don't want to change my code (to make it working exactly in the same way on GCP). However, for that, a fix is required on my previous contribution in the golang.org/x/oauth2 library (here my pull request to set a default scope is no scope is defined). To have an overview of a working solution, here my current commit that work with the fix. I will create a pull request as soon as the fix is merged. |
I have a similar problem but with I have a Workload Identity Federation setup and am using Keyless API authentication, basically just setting My first question would be if this is even intended to be supported, that is to get an ID token for an If so, would my issue be included in the scope for this issue or should I open a new one? Or is there in fact a way for me to actually get a token source that returns ID tokens since I also need to create a client that automatically sets a valid token on each request. I looked into |
I hit the same problem described above. Is there a solution? |
This is now supported as of #1792 |
looks like the above PR added support only for type |
@senthilkumarkj That was intentional as the original issue was about |
Thanks, Cody. Opened new issue to track it - #1879. Without this we are unable to call Cloud Run APIs in Google Cloud from a non google platform with Workload Identity Federation. |
Environment details
Steps to reproduce
authClient, err := idtoken.NewClient(ctx, endpoint)
Problem
Trying to use an
impersonated_service_account
token doesn't work because only tokens with typeservice_account
are supported.google-api-go-client/idtoken/idtoken.go
Lines 139 to 141 in c890ff5
Anywhere a service account can be used an impersonated service account should also be valid. I'm getting the error
idtoken: credential must be service_account, found "impersonated_service_account"
The text was updated successfully, but these errors were encountered: