Firebase Cloud Messaging (FCM) authentication methods - Amazon Simple Notification Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Firebase Cloud Messaging (FCM) authentication methods

This topic describes how to obtain the required FCM API (HTTP v1) credentials from Google to use with the Amazon API, Amazon CLI and the Amazon Web Services Management Console.

Important

June 20, 2023 – Google deprecated their Firebase Cloud Messaging (FCM) legacy HTTP API. Amazon SNS now supports delivery to all device types using FCM HTTP v1 API. We recommend that you migrate your existing mobile push applications to the latest FCM HTTP v1 API on or before June 1, 2024 to avoid disruption.

January 18, 2024 – Amazon SNS introduced support for FCM HTTP v1 API for mobile push notification delivery to Android devices.

March 26, 2024 – Amazon SNS supports FCM HTTP v1 API for Apple devices and Webpush destinations. We recommend that you migrate your existing mobile push applications to the latest FCM HTTP v1 API on or before June 1, 2024 to avoid application disruption.

You can authorize Amazon SNS to send push notifications to your applications by providing information that identifies you as the developer of the app. To authenticate, provide either an API key or a token when creating a platform application. You can get the following information from your Firebase application console:

API Key

The API key is a credential used when calling Firebase’s Legacy API. The FCM Legacy APIs will be removed by Google June 20, 2024. If you are currently using an API key as your platform credential, you can update the platform credential by selecting Token as the option, and uploading the associated JSON file for your Firebase application.

Token

A short lived access token is used when calling the HTTP v1 API. This is Firebase’s suggested API for sending push notifications. In order to generate access tokens, Firebase provides developers a set of credentials in the form of a private key file (also referred to as a service.json file).

Prerequisite

You must obtain your FCM service.json credentials before you can begin managing FCM settings in Amazon SNS. To obtain your service.json credentials, see Migrate from legacy FCM APIs to HTTP v1 in the Google Firebase documentation.

Managing FCM settings (API)

You can create FCM push notifications using the Amazon API. The number and size of Amazon SNS resources in an Amazon account are limited. For more information, see Amazon Simple Notification Service endpoints and quotas in the Amazon Web Services General Reference Guide.

To create an FCM push notification together with an Amazon SNS topic (Amazon API)

When using key credentials, the PlatformCredential is API key. When using token credentials, the PlatformCredential is a JSON formatted private key file:

To retrieve an FCM credential type for an existing Amazon SNS topic (Amazon API)

Retrieves the credential type "AuthenticationMethod": "Token", or "AuthenticationMethod": "Key":

To set an FCM attribute for an existing Amazon SNS topic (Amazon API)

Sets the FCM attribute:

Managing FCM settings (CLI)

You can create FCM push notifications using the Amazon Command Line Interface (CLI). The number and size of Amazon SNS resources in an Amazon account are limited. For more information, see Amazon Simple Notification Service endpoints and quotas.

To create an FCM push notification together with an Amazon SNS topic (Amazon CLI)

When using key credentials, the PlatformCredential is API key. When using token credentials, the PlatformCredential is a JSON formatted private key file. When using the Amazon CLI, the file must be in string format and special characters must be ignored. To format the file correctly,Amazon SNS recommends using the following command: SERVICE_JSON=`jq @json <<< cat service.json`:

To retrieve an FCM credential type for an existing Amazon SNS topic (Amazon CLI)

Retrieves the credential type "AuthenticationMethod": "Token", or "AuthenticationMethod": "Key":

To set an FCM attribute for an existing Amazon SNS topic (Amazon CLI)

Sets the FCM attribute:

Managing FCM settings (console)

Use the following steps to enter the credentials that your application uses to connect to FCM.

  1. Sign in to the Amazon SNS console.

  2. Under Mobile, choose Push notifications.

  3. Select an existing FCM application and choose Edit. If you haven't already created a platform application, see Creating a platform application.

  4. On the Edit page, for Firebase Cloud Messaging Credentials, choose either Token or Key. You can get the following information from your Firebase application console.

    • If you choose Token, upload a valid private key file. The contents of this file are used to generate short-lived access tokens when sending notifications.

    • If you choose Key, enter the Google API key.

  5. When you finish, choose Save changes.

Related topics