Using the GOOGLE_APPLICATION_CREDENTIALS environment variable
After you have created your service account, downloaded the JSON file, and saved it in some location, you can set the
GOOGLE_APPLICATION_CREDENTIALS environment variable with the path of your service account JSON file.
With that in place, the Application Default Credentials Example sample code should just work for you.
Using the service account file directly to create the client
It’s all fine and good if you only use one service account file all throughout the application but if you happen to need to use a specific JSON file per call, this section is for you.---
If you have any questions or feedback, please reach out @flowerinthenyt.
This work is licensed under a Creative Commons Attribution 4.0 International License.