FCM Service Account Private Key Setup¶
This guide walks you through setting up Firebase Cloud Messaging (FCM) for enabling push notifications in Android apps using a security-focused, least-privilege approach.
The process has three steps:
- Create a least-privilege IAM role for push messaging.
- Generate a service account private key.
- Upload or hand over the key depending on your app type.
Prerequisites¶
You must have a Firebase account and project for your application to start using FCM. If you do not have them, complete the following before proceeding:
- Create a Google account at accounts.google.com.
- Create a Firebase project at console.firebase.google.com.
1. Create a Push Notification Role¶
You need a service account assigned a role with the cloudmessaging.messages.create permission.
- Sign in to console.firebase.google.com.
- On the Firebase console, select your softphone project.
- Select the Project Overview Settings icon > Project settings.
- On the Project settings pane:
- Select the Cloud Messaging tab.
- Select Manage Service Accounts of the desired Sender ID.
- In the IAM & Admin section, select Roles on the left navigation menu.
- On the Roles pane, select + CREATE ROLE at the top navigation bar.
-
Under Create Role, enter a descriptive name for this role in the Title and ID fields.
Example
- Title - Acrobits Push Role
- ID - AcrobitsPushRole
-
Select + ADD PERMISSION, search for
cloudmessaging.messages.create, and select its check box.Tip
To filter for quicker search, enter "cloudmessaging" in the filter field, then select
cloudmessaging.messages.createfrom the suggestions. -
Select ADD, then select Create at the bottom of the pane.
2. Create a Service Account¶
- In the IAM & Admin section, select Service Account on the left navigation menu.
- Select + CREATE SERVICE ACCOUNT at the top navigation bar.
-
Under Service account details, enter a descriptive name and description.
Example
- Service account name - Acrobits Push Service account
- Service account description - Allow Acrobits to send pushes.
-
Select CREATE AND CONTINUE.
-
In Grant this service account access to project, select the Select a role drop-down and search for the role created in the previous section (e.g., Acrobits Push Role). Select it.
Tip
Enter the role title in the Type to filter field to find it quickly.
-
Select CONTINUE.
Note
In Grant users access to this service account, you may leave the Service account users role and Service account admins role fields blank.
-
Select DONE.
3. Download the Service Account Private Key¶
- In the IAM & Admin section, select Service Account on the left navigation menu.
- Locate the service account that handles push notifications.
- Under the Actions column, select the three-dot menu > Manage keys.
- Select ADD KEY > Create new key.
- Ensure the JSON radio button is selected.
- Select CREATE.
- Save the private key file to your local computer.
4. Deploy the Private Key¶
- Log in to the Cloud Softphone portal at providers.cloudsoftphone.com.
- Select your white-label app softphone project.
- Select the Edit button of the Whitelabel options.
- At the Android Firebase Private Key section, select the Select file button.
- Locate and upload the private key file in JSON format.
Contact your Acrobits representative through your designated SDK support channel to arrange a secure key handover. Once received, the Acrobits team will deploy the key to the appropriate environment on your behalf.