firebase / firebase/firebase-tools
Documented authentication priority is incorrect
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
This is minor, but we tripped over it in our CI today. [The readme](https://github.com/firebase/firebase-tools/blob/0cf70a09849aa5246c5165bf81cd14d2fcb025aa/README.md#general) gives an auth priority order of:
- `GOOGLE_APPLICATION_CREDENTIALS`
- `firebase login`
- `FIREBASE_TOKEN`
- `gcloud auth application-default login`
[The code](https://github.com/firebase/firebase-tools/blob/7133c28f2435ef61df45e3649b7342cfa9f26695/src/requireAuth.ts#L55-L64) has a different order along with the additional `--token` option:
- `--token` flag
- `FIREBASE_TOKEN`
- `firebase login`
- `GOOGLE_APPLICATION_CREDENTIALS`
- `gcloud auth application-default login`
Since this is likely a docs change, I'll add that it would be nice if the [public documentation](https://firebase.google.com/docs/cli#cli-ci-systems) included the service account option. It's fairly hidden here and the token options don't work in CI if you set a GCP [session duration](https://support.google.com/a/answer/9368756?hl=en).
### [REQUIRED] Environment info
**firebase-tools:** 8.15.0
**Platform:** Any
### [REQUIRED] Steps to reproduce
```sh
export GOOGLE_APPLICATION_CREDENTIALS=service-account.json
export FIREBASE_TOKEN=invalid
firebase projects:list
# Error: Failed to list Firebase projects. See firebase-debug.log for more info.
```
Contributor guide
Assessment
This issue has not been assessed yet.