Resolve FCM Token Refresh Bug

Job ID: 40602469

Budget: ₹2,000 – ₹3,500 INR

My web‐based application relies on Firebase Messaging, and the token lifecycle has suddenly gone off the rails. Browsers are no longer registering fresh tokens after a refresh or new login, while the database keeps holding on to stale ones. As a result, users miss both in-app messages and push notifications.

What I need from you: investigate the current token registration flow (service-worker, client SDK, and any Admin SDK routines), identify why new tokens fail to reach Firestore/Realtime DB, and implement reliable cleanup of outdated tokens so they stop blocking deliveries. Once fixed, I want proof that:

• a first-time visitor receives a valid token and can be targeted immediately
• an existing user who refreshes or clears permissions gets a new token that overwrites the old entry
• legacy tokens are purged or marked invalid in the database
• messages and web push notifications arrive consistently in Chrome, Edge, and Firefox

Share concise code changes, a short README of what you touched, and any testing steps I can reproduce locally. If you can wrap this up swiftly, even better—I’ll test on staging and sign it off straight away.