firebase / firebase/firebase-admin-go
FR: Allow JSON string to be passed to GOOGLE_APPLICATION_CREDENTIALS
- Dominant language
- Go
- Stars
- 1.3k
- Forks
- 274
- Avg merge
- 10h 39m
- Merged PRs (30d)
- 2
Description
* 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](https://github.com/firebase/firebase-admin-go/blob/b04387eff11f911cf10e9a76f4fcbf517b6c9a62/firebase.go#L176) is parsed this way.
For example:
```go
secret := someSecretStore.Get("GOOGLE_CREDS")
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", secret)
...
# initialize firebase App
```
Contributor guide
Research direction
Start with firebase.go, especially the firebase_config parsing referenced in the issue, then trace how GOOGLE_APPLICATION_CREDENTIALS is consumed during Firebase App initialization. The change is done when credentials supplied as a JSON string work without a file while existing file-path behavior remains intact; the payload does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100