FCM Authentication is one of the methods to enable sending push notifications to your app installed on Android devices. The Authentication token is used to authorize server requests to Firebase services. You must generate the FCM Authentication Token and upload it to the MoEngage Dashboard to send Push notifications to Android users.
library_add_check |
Prerequisites You have an app created on the Firebase console. |
Authorizing Server Requests to Firebase Services
You can authorize server requests to Firebase services using one of the following methods:
- Private Key - A service account JSON file that contains the details of the Private Key generated for authenticating the service account
- Server key - With the HTTP legacy protocol, each request must contain the server key from the Cloud Messaging tab of the Firebase console Settings pane. This method was deprecated by FCM on June 20, 2023, and will be removed in June 2024
-
Steps to Generate Private Key
- Login to the Firebase console with your credentials.
- Select your Project.
- In the top left pane, click on Settings beside Project Overview.
- Select Project Settings.
- In the Project Settings page, navigate to the Service Accounts tab.
- Click Generate New Private Key.
- Confirm the same by clicking Generate Key.
- This will generate a JSON file containing the Private Key.
- Download the JSON file and upload it to the MoEngage Dashboard in the following navigation: Settings-> Channel -> Push -> Mobile Push -> Android -> FCM Authentication -> Private Key.
- Once the JSON is configured, FCM should be enabled in the cloud console.
warning |
Critical Sending messages (including upstream messages) with the FCM XMPP and HTTP legacy APIs was deprecated on June 20, 2023, and will be removed in June 2024, refer to Deprecation of Legacy HTTP API. |
Steps to Find FCM Server Key
- Login to the Firebase console with your credentials.
- Select your Project.
- In the top left pane, click on Settings beside Project Overview.
- Select Project Settings.
- In the Project Settings page, navigate to the Cloud Messaging tab.
- Copy the server key from Project Credentials and add it to the MoEngage Dashboard in the following navigation: Settings-> Channel -> Push -> Mobile Push -> Android -> FCM Authentication -> Private Key.
- Navigate to the General tab in Project Settings.
- Select the Android app to be added to Firebase. The first step would be the registration process. Add the package name of your app while registering the app.
- Once registration is successful, you can download the config file - the google-services.json file.
- Place this file in your app's root module.