最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Google Application Default Credentials on GCECloud Run with impersonificationdelegated API calls - Stack Overflow

programmeradmin1浏览0评论

I have trouble getting working ADC on Cloud Run with Google APIs like Directory or Gmail API which need to have target user set as createDelegated(targetUser)

on credential. When I use GOOGLE_APPLICATION_CREDENTIALS pointing to existing json file with service account id and key, it is working with no problems, but when i drop this ENV property and let the GoogleCredentials.getApplicationDefault() obtain credential automatically from GCE Metadata server these impersonificated requests are failing with 403 "Not Authorized to access this resource/api" error.

Code is the same for both cases

GoogleCredentials.getApplicationDefault().createScoped(scopes).createDelegated(targetUser);

then using google libraries from Directory or Gmail which by debugging call refreshAccessToken on ServiceAccountCredentials or ComputeEngineCredentials object - both resulting in access token belonging to the same azd/aud and scopes, only difference is access_type field which is offline for SAC and online for GEC.

Other APIs (without impersonification) like Marketplace seems to be working in both Service/Compute credentials, so there has to be some issue or other configuration/programming needed for the impersonification usage which I am unable to recover and need any asistance.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论