How can I authorize a Google Service Account without the default credentials file?

前端 未结 3 1784
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 12:20

I have a Google Service Account that my app uses to retrieve data from Google Analytics.

When I created the account I downloaded a client_secrets file with

3条回答
  •  天涯浪人
    2021-02-04 12:51

    I found the answer in the source code of the google-auth-library-ruby gem.

    It turns out that there is another option: take the values from the client_secrets file and put them in environment variables named GOOGLE_ACCOUNT_TYPE, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_EMAIL and GOOGLE_PRIVATE_KEY respectively.

    If these keys are populated, the credentials will load from there. Not a whisper of this in the docs, though.

提交回复
热议问题