FG
📱 Mobile & Cross-PlatformGoogleproduction

Android push notifications stop working after app updated to FCM v1 API

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score0%
0%

Problem

Push notifications stop delivering after migrating from the deprecated FCM Legacy API to FCM HTTP v1. The server sends requests but Firebase returns 200 — yet notifications never arrive. The v1 API uses OAuth 2.0 service account authentication instead of a server key. Apps that simply swap the endpoint without updating the authentication mechanism will get silent failures.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Update Authentication Mechanism for FCM v1 API

Medium Risk

The issue arises because the FCM v1 API requires OAuth 2.0 service account authentication, while the previous FCM Legacy API used a server key. If the server requests are sent using the old authentication method without updating to the new OAuth 2.0 mechanism, Firebase will respond with a 200 status code, but the notifications will not be delivered, leading to silent failures.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Create a Service Account in Google Cloud Console

    Navigate to the Google Cloud Console, select your project, and create a new service account. Grant the service account the 'Firebase Cloud Messaging Admin' role to ensure it has the necessary permissions.

  2. 2

    Generate and Download Service Account Key

    In the service account settings, generate a new private key in JSON format. Download this key file, as it will be used for authentication in your server application.

  3. 3

    Implement OAuth 2.0 Authentication in Your Server Code

    Update your server code to use the downloaded service account key for OAuth 2.0 authentication. Use a library like Google Auth Library to obtain an access token. Here’s an example in Node.js:

    javascript
    const { GoogleAuth } = require('google-auth-library');
    const auth = new GoogleAuth({
      keyFile: 'path/to/service-account-file.json',
      scopes: ['https://www.googleapis.com/auth/firebase.messaging'],
    });
    
    async function getAccessToken() {
      const client = await auth.getClient();
      const token = await client.getAccessToken();
      return token;
    }
  4. 4

    Update FCM Request to Use Bearer Token

    Modify your FCM request to include the Bearer token obtained from the OAuth 2.0 authentication. Here’s an example of how to send a notification using the fetch API in JavaScript:

    javascript
    const token = await getAccessToken();
    const response = await fetch('https://fcm.googleapis.com/v1/projects/YOUR_PROJECT_ID/messages:send', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        message: {
          token: 'DEVICE_FCM_TOKEN',
          notification: {
            title: 'Hello',
            body: 'World',
          },
        },
      }),
    });
  5. 5

    Test Notification Delivery

    After implementing the changes, send a test notification to a device registered with FCM. Monitor the device to confirm that the notification is received successfully.

Validation

To confirm the fix worked, check the device for the receipt of the push notification. Additionally, monitor the server logs for successful responses from the FCM API, ensuring that the response includes a valid message ID.

Sign in to verify this fix

Environment

Product
Firebase Cloud Messaging (FCM)
Environment
production

Submitted by

AC

Alex Chen

2450 rep

Tags

fcmfirebasepush-notificationsandroidfcm-v1oauth2