问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/61257237/how-to-access-gcp-secret-manager-from-angular-9-web-app-service