Add Service Account

Now it's time to add a new config file that should never be published within the app. This step is only necessary if you plan to run database seeds for testing.

This is a sensitive information intended to only run on backend. So make sure this file will be present in your .gitignore afterwards

Grab your config

From Firebase menu, click the cog button located right after Project Overview and then access Project Settings

firebase project settings

Then access the Service accounts tab and generate a new private key for Node.js

firebase service account

Paste in the correct place

Once the json is downloaded copy it to the seeds folder and rename the file to service-account.json

  "type": "service_account",
  "project_id": "my-app-d7vac",
  "private_key_id": "632c0f93346d5287334f714a5ae2b2e92ccbfc9",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADA",
  "client_email": "",
  "client_id": "1091161964712176364",
  "auth_uri": "",
  "token_uri": "",
  "auth_provider_x509_cert_url": "",
  "client_x509_cert_url": ""

Final result should look like as the code snippet above. Make sure to add this file into your .gitignore

Edit this page on GitHub Updated at Thu, Nov 17, 2022