Closed vanpyrzericj closed 4 years ago
FIREBASE_CONFIG
is not a way to specify credentials. It is in addition to Google Application Default Credentials.
The SDK can also be initialized with no parameters. In this case, the SDK uses Google Application Default Credentials and reads options from the FIREBASE_CONFIG environment variable.
Meaning you must set GOOGLE_APPLICATION_CREDENTIALS
to point to the service account JSON file, and use Firebase FIREBASE_CONFIG
to specify any remaining Firebase options (database URL, storage bucket, project ID etc). Also note that:
GOOGLE_APPLICATION_CREDENTIALS
.projectId
can be set via FIREBASE_CONFIG
today. Anything else is effectively ignored.
Per the documentation here in the section Initialize without parameters, I expect to be able to call
and provide the contents of my Firebase service account JSON file in the environmental variable called
FIREBASE_CONFIG
. However, upon running my application, the following exception is thrown:System.InvalidOperationException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials.
So is the documentation wrong? It seems to still be expecting me to set
GOOGLE_APPLICATION_CREDENTIALS
.Is the only way to provide the service account credentials through a file and I cannot directly pass the contents of said file when I want to initialize it?