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:

  1. download json file credentials.
  2. put json file `functions directory.
  3. refer code: keyfilename: './keyfile.json'

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -