Skip to content

feat(messaging): migrate FCM Web quickstart to FID-based APIs - #1080

Open
hozhng wants to merge 1 commit into
firebase:masterfrom
hozhng:feat/fcm-fid-api-migration
Open

feat(messaging): migrate FCM Web quickstart to FID-based APIs#1080
hozhng wants to merge 1 commit into
firebase:masterfrom
hozhng:feat/fcm-fid-api-migration

Conversation

@hozhng

@hozhng hozhng commented Aug 18, 2026

Copy link
Copy Markdown

Description

Migrate Firebase Cloud Messaging (FCM) Web quickstart sample app to use the new FID-based SDK APIs.

Key Changes

  • API Migration: Replaced deprecated getToken / deleteToken with register / unregister and onRegistered / onUnregistered callbacks in messaging/main.ts.
  • UI & Terminology: Updated UI text and DOM elements from "Registration Token" to "Installation ID (FID)".
  • Permission & Non-user-gesture Handling: Added proper permission state checks on initial page load to avoid browser permission prompt suppressions.
  • Dependency Upgrade: Bumped firebase to ^12.17.1.
  • Documentation: Updated README.md to reflect FID registration flow and FCM HTTP v1 cURL format.

Verification

  • Tested locally with Vite (npm run dev).
  • Verified permission granting, onRegistered callback receiving FID, Foreground onMessage handler, and unregister flow.
  • Verified TypeScript build passes (npm run build).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Firebase Cloud Messaging (FCM) Quickstart sample to use the latest Firebase SDK (v12.17.1) and transitions the implementation from legacy registration tokens to the new FID-based (Firebase Installation ID) APIs. Key changes include updating the main application and service worker scripts, revising the HTML UI to display the FID, and updating the README with the FCM HTTP v1 API documentation. The review feedback highlights several critical issues: a version mismatch between the service worker and the main application, potential runtime crashes in environments lacking the Notification API, a UI bug where denied permission errors are hidden, and a typo in the HTML charset attribute.

Comment thread messaging/firebase-messaging-sw.js Outdated
Comment thread messaging/main.ts
Comment thread messaging/main.ts
Comment thread messaging/index.html Outdated
@hozhng
hozhng force-pushed the feat/fcm-fid-api-migration branch 7 times, most recently from 9bfe127 to f439ad6 Compare August 18, 2026 19:42
@hozhng
hozhng marked this pull request as draft August 18, 2026 20:51
@hozhng
hozhng marked this pull request as ready for review August 18, 2026 20:53
Comment thread messaging/README.md
Comment thread messaging/README.md
Comment thread messaging/README.md
Comment thread messaging/README.md
Comment thread messaging/firebase-messaging-sw.js
Comment thread messaging/index.html
Comment thread messaging/index.html Outdated
Comment thread messaging/main.ts
Comment thread messaging/main.ts
Comment thread messaging/main.ts
@hozhng
hozhng force-pushed the feat/fcm-fid-api-migration branch 2 times, most recently from 081c23e to 14de063 Compare August 25, 2026 17:53
- Replace deprecated getToken/deleteToken with register/unregister and onRegistered/onUnregistered callbacks
- Update UI elements and terminology from Registration Token to Installation ID (FID)
- Upgrade firebase dependency to ^12.17.1 to support FID APIs
- Update README documentation and cURL instructions for FCM HTTP v1 API

Bug: b/522441204
@hozhng
hozhng force-pushed the feat/fcm-fid-api-migration branch from 14de063 to f7f3feb Compare August 25, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants