Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is or What is the serviceAccountKey.json is the node js sample of firebase realtime database

I have downloaded the zip of Firebase real-time database node.js sample and navigate to the database section

https://github.com/firebase/quickstart-nodejs/tree/master/database

And I located to the line 35 which has the following code

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

But I was wondering where is/what is the serviceAccountKey.json?

like image 541
Andrew Avatar asked Jun 19 '17 09:06

Andrew


People also ask

Where is serviceAccountKey JSON?

in a nutshell, you generate serviceAccountKey. json file by requesting a new private key from the service accounts tab of your settings page in your Firebase dashboard.

Where is JSON file in Firebase?

Open your browser, go to your Firebase console->Three Dots on the right->Import JSON. Important to note that when importing, whichever node you have selected in your Firebase database will be overwritten, so make sure you don't have your root node selected - create a child node and then do your import.

What is JSON file in Firebase?

All Firebase Realtime Database data is stored as JSON objects. You can think of the database as a cloud-hosted JSON tree. Unlike a SQL database, there are no tables or records. When you add data to the JSON tree, it becomes a node in the existing JSON structure with an associated key.

What is the serviceaccountkey JSON?

Where is or What is the serviceAccountKey.json is the node js sample of firebase realtime database 1 Reference path for service account key Related 4100 What are the differences between a HashMap and a Hashtable in Java?

How to create a JSON key for a service?

Once you create the service account, right click on the three dots and select "create key". It should prompt you with JSON option. Download and store it within your project directory. Share Follow answered Apr 2 '18 at 11:31

How to generate a service account key in Firebase?

in a nutshell, you generate serviceAccountKey.json file by requesting a new private key from the service accounts tab of your settings page in your Firebase dashboard. The returned private key will be a.json file which will be your serviceAccountKey.json file... once you rename it to be serviceAccountKey.json

How do I authorize a service account using a JSON file?

Securely store the JSON file containing the key. When authorizing via a service account, you have two choices for providing the credentials to your application. You can either set the GOOGLE_APPLICATION_CREDENTIALS environment variable, or you can explicitly pass the path to the service account key in code.


1 Answers

  1. require('path/to/serviceAccountKey.json') means - call this file to be used in the file you are calling it

  2. serviceAccountKey.json is a file that you have to generate

  3. If you look at this page 'Add Firebase To Your App' https://firebase.google.com/docs/ios/setup under 'Add Firebase to your app' - it says Navigate to the Service Accounts and generate a new private key, doing this will generate what will be your 'serviceAccountKey.json' file after you rename it

  4. place that file in the directory of your choosing local to your cloud code directory, have a look at this comment https://stackoverflow.com/a/42634321/2472466 for more insight into step 4

like image 110
t.ios Avatar answered Oct 21 '22 14:10

t.ios