Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is "serviceAccountKey.json" referring to in the Firebase device-to-device notifications tutorial

I managed to go through the complete Firebase Android Codelab without too much problem, the app works perfectly. Now I would like to add device-to-device notifications. I found this tutorial: And some things are not clear to me.

  1. In the node script there is a line like this:

var serviceAccount = require("path/to/serviceAccountKey.json");

What is the "ServiceAccountKey.json" file? Is it just another name for google-services.json? If not, what is this?

  1. Is there a simple "click through" tutorial how to deploy the node server code to the google environment?
like image 459
Entman Avatar asked Jan 26 '17 13:01

Entman


People also ask

What is serviceAccountKey JSON?

serviceAccountKey.json is not the actual file name However, it's just a place-holder name. The file is generated with a unique name from the Google Web UI, and that is the file to apply where the place-holder is referenced.


1 Answers

In the blog post you're following, we're running the node.js script on Google Cloud's App Engine Flexible Environment using the Firebase Admin SDK. A service account is a way to give trusted processes access to Google Cloud Platform and Firebase resources.

You create a service account through the Google Cloud Console and then download the corresponding JSON file. The code in the blog post looks for that file and use it to initialize the Firebase Admin SDK.

like image 56
Frank van Puffelen Avatar answered Oct 14 '22 00:10

Frank van Puffelen