fix: Deferring credential loading until required #361
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the
firebase.NewApp()
functions attempts to load Google credentials, and fails fast if the ADC lookup fails. But some use cases (e.g. ID token verification) do not require credentials at all. This PR makes the following changes to support such use cases a little better:firebase
package looks up credentials only to discover a project ID. But this is performed as a "soft" lookup, and errors at this stage are not exposed to the user.auth
package performs its own credential look up to discover service account private key. This is also performed as a soft lookup without fail fast (this was in fact the existing behavior of the auth package).This makes it possible to do things like:
Resolves #357
RELEASE NOTE: Deferred credential loading until required, which allows some APIs like
auth.VerifyIDToken()
to be called without credentials.