firebase / firebase-admin-go

Firebase Admin Go SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FR: Allow JSON string to be passed to GOOGLE_APPLICATION_CREDENTIALS

lordvidex opened this issue · comments

  • Firebase Product: FCM

In order to use this library to send push notifications, it is necessary to pass the services_account.json file path to the environment variable GOOGLE_APPLICATION_CREDENTIALS.
However, allowing the JSON string to be passed directly will also help for certain scenarios where the the secret do not necessary exist in a file.

In fact, the firebase_config is parsed this way.

For example:

secret := someSecretStore.Get("GOOGLE_CREDS")
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", secret)
...
# initialize firebase App