FCM getToken() fails in Firebase-hosted Android PWA with messaging/token-subscribe-failed and “missing required authentication credential”
08:57 13 Mar 2026

I am trying to enable Firebase Cloud Messaging web push in a Firebase-hosted PWA on Android Chrome, but getToken() fails and no FCM token is created.

Setup

  • Firebase Hosting

  • Firestore

  • Android phone

  • Chrome

  • App installed as PWA

  • VAPID key created in Firebase Console → Cloud Messaging

  • firebase-messaging-sw.js exists and loads

Goal

Register a web push token and save it in Firestore under the user document:

  • pushEnabled

  • pushTokens

Problem

Notification permission is granted, the service worker is ready, but getToken() fails.

No token is returned.
pushEnabled stays false.

Exact error

FirebaseError — Messaging: A problem occurred while subscribing the user to FCM: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. (messaging/token-subscribe-failed)

Service worker

importScripts('https://www.gstatic.com/firebasejs/12.10.0/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/12.10.0/firebase-messaging-compat.js');

firebase.initializeApp({
  // config here
});

const messaging = firebase.messaging();

messaging.onBackgroundMessage((payload) => {
  console.log('Background message received:', payload);
});

What I already checked

  • VAPID key created and passed to getToken()

  • Notification permission is granted in Chrome

  • Site notification permission is allowed

  • PWA removed and reinstalled

  • Chrome cache/storage cleared

  • Tested both installed PWA and normal Chrome tab

  • Firebase JS SDK downgraded from 12.10.0 to 10.14.1

  • Anonymous Auth enabled

  • signInAnonymously() added before calling getToken()

  • Firestore works normally

  • Service worker is registered and ready

  • Required Google Cloud APIs enabled:

    • FCM API

    • Firebase Management API

Relevant client code

const app = initializeApp(firebaseConfig);
const messaging = getMessaging(app);

await navigator.serviceWorker.register('/firebase-messaging-sw.js');

const permission = await Notification.requestPermission();
console.log('permission:', permission);

if (permission === 'granted') {
  const token = await getToken(messaging, {
    vapidKey: 'MY_VAPID_KEY',
    serviceWorkerRegistration: await navigator.serviceWorker.ready
  });
  console.log('token:', token);
}

Current behavior

  • Permission is granted

  • Service worker is ready

  • getToken() throws messaging/token-subscribe-failed

  • No token is generated

What I am trying to understand

  • Whether this error points to Firebase project / API configuration

  • Whether this is a known Android Chrome PWA issue

  • Whether FCM web token registration should work without Firebase Auth

  • Whether there is a specific mismatch I should check first, such as sender ID, VAPID key, service worker scope, or Firebase config

Any pointers on the most likely root cause would be appreciated.

Tags:
firebase firebase-cloud-messaging progressive-web-apps service-worker google-chrome

android firebase google-cloud-firestore firebase-realtime-database firebase-cloud-messaging