Found details about this in this link
[UPDATED 30.11.2021]
To generate a private key file for your service account:
In the Firebase console, open Settings > Service Accounts.
Click Generate New Private Key, then confirm by clicking Generate Key.
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. The first
option is more secure and is strongly recommended.
NB: When you generate a new private key, the old key will stop working immediately
To create the a new private key file you need to go to this link
https://console.firebase.google.com/project/**YOUR_PROJECT**/settings/serviceaccounts/adminsdk
[OLD]
Quote from firebase docs:
- Navigate to the Service Accounts tab in your project's settings page.
- Click the Generate New Private Key button at the bottom of the Firebase Admin SDK section of the Service Accounts tab.
After you click the button, a JSON file containing your service
account's credentials will be downloaded. You'll need this to
initialize the SDK in the next step.
Warning: Use extra caution when
handling service account credentials in your code. Do not commit them
to a public repository, deploy them in a client app, or expose them in
any way that could compromise the security of your Firebase project.
This file is only generated once. If you lose or leak the key, you can
repeat the instructions above to create a new JSON key for the service
account.