简体   繁体   中英

How to access GCP Secret Manager from Angular 9 web app service

I am having Angular service (Cloud Run fully managed) from which I would like to access 'googleapis' Secret Manager API with HTTP client call.

The problem is I do not find a way to get the current service account's auth token that I can further use into the Authorization header field. This is an approach to use Secret Manager API, but I can change this with possible other solutions too unless it is working from the Agular app.

Thanks a lot in advance.

I found a conceptual solution to the problem. It is described in the Cloud Run documentation . In general, it makes an API call to metadata server to receive an access token for the service account (default or another particular one) which can be later used in the header field Authorization for any other google APIs calls. The described solution works only from inside GCP (I have tested it from Cloud shell with curl and it works fine). From my application using httpClient though I run into Gateway timeout Error, I will open another question for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM