firebase-admin already lookup gcloud application default credentials out of the box:
|
const GCLOUD_CREDENTIAL_SUFFIX = 'gcloud/application_default_credentials.json'; |
which is great!
It would awesome if it could also look up firebase-tools credentials in a similar fashion, so that:
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.applicationDefault()
});
could just work for `firebase-tools users without requiring the user to install gcloud or download service account key to their development environment.
Note you can workaround this today by doing:
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.refreshToken({type: 'authorized_user', refresh_token: (new (require('configstore'))('firebase-tools')).get('tokens.refresh_token'), client_id: require('firebase-tools/lib/api').clientId, client_secret: require('firebase-tools/lib/api').clientSecret})
});
But it seems quite fragile if firebase-tools ever decide to change the location of the refresh token / client id / secret.
firebase-admin already lookup gcloud application default credentials out of the box:
firebase-admin-node/src/auth/credential.ts
Line 45 in 1a7f722
It would awesome if it could also look up
firebase-toolscredentials in a similar fashion, so that:could just work for `firebase-tools users without requiring the user to install gcloud or download service account key to their development environment.
Note you can workaround this today by doing:
But it seems quite fragile if
firebase-toolsever decide to change the location of the refresh token / client id / secret.