问题
I have a Google Cloud Platform service account with domain-wide authority. I can add it to a Google Analytics API call from my terminal and it works correctly. However, I would like to run that same script as a Google Cloud Function and reference the service account in GCP without including the client_secret_service_account.json file (like below) in the repository or anywhere outside of GCP. Is that possible?
KEY_FILE_LOCATION = 'client_secret_service_account.json'
回答1:
You can now reference the service account when deploying Cloud Functions. Check documentation for gcloud.
When using GCP console, expand "Advanced options" to inform the service account
来源:https://stackoverflow.com/questions/55671256/how-to-use-gcp-service-account-in-google-cloud-function