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

Entman picture Entman · Jan 26, 2017 · Viewed 21.2k times · Source

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?

Answer

Frank van Puffelen picture Frank van Puffelen · Jan 26, 2017

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.