简体   繁体   中英

How to authenticate to GCP API with service account file

I am new user to GCP. I starting to implement an application that is going to use GCP API. In order to authenticate to API I've created service account and stored it in file. In official documentation it is written that auth file can be assigned to environment variable: GOOGLE_APPLICATION_CREDENTIALS I would like to make a request to google API from my http client (let's say Postman) and to use this file for authentication.

Is it possible at all or I suppose to use GCP client in order to make HTTP requests?

Yes, you can create an authenticate API key, and use that API key to call GCP API. Here is the doc for Creating and Using API key .

Also, you need to be careful not to expose your API keys to the public, like Github. Because we have seen many people just write their API key directly in the code and expose to the public.

As you said, you would like to use the API key in HTTP request, maybe you should add restrictions to your keys.

Here are some best practices that Google provided, hope this helps!

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