Reputation: 13
I am referring to the next article what is "serviceAccountKey.json" referring to in the Firebase device-to-device notifications tutorial
There is one statement written in the index.js file
var serviceAccount = require("path/to/serviceAccountKey.json");
I would like to know what would be the path here when writing the script in the google cloud function web interface.
Do I have to upload the json file on a bucket and then give the bucket reference path?
Upvotes: 1
Views: 2054
Reputation: 599601
You should put your serviceAccountKey.json in the same folder as your index.json
. Then when you deploy to Cloud Functions, both the code and the key file will be uploaded and you can refer to the JSON from the code with:
var serviceAccount = require("./serviceAccountKey.json");
Note that you may want to consider using the Admin SDK for Firebase Cloud Messaging to send messages these days. This SDK didn't exist when I wrote blog post, but makes the code for sending messages simpler (at the cost of using an extra SDK).
Upvotes: 2