Integrate google-cloud with firebase functions -
when integrating google cloud on node.js, described here: https://www.npmjs.com/package/google-cloud
one should include json file secret credentials , keys:
var config = { projectid: 'grape-spaceship-123', keyfilename: '/path/to/keyfile.json' };
when using firebase functions / google cloud functions, how can done?
cloud functions run trusted cloud account already. in cases shouldn't need add credentials json file. example, how initialize cloud storage in 1 of our apps:
const gcs = require('@google-cloud/storage')();
as see, we're not passing in authorization information, yet code still able access cloud storage:
const file = gcs.bucket('your_firebase_project_id.appspot.com').file(filepath);
if have case need credentials file:
- download json file credentials.
- put json file `functions directory.
- refer code:
keyfilename: './keyfile.json'
Comments
Post a Comment