Menu

1 / 2

Migrating from the FCM legacy API to HTTP v1

DEV Community: android·Rushi Patel·6 days ago
#XxC9pJ3R
#devtoandroid#devto#dev#token#firebase
Reading 0:00
15s threshold

If your server still posts to https://fcm.googleapis.com/fcm/send with a server key, it has stopped delivering. Firebase deprecated the legacy HTTP and XMPP APIs on 20 June 2023 and began shutting them down on 22 July 2024 . The replacement is the HTTP v1 API . Your app does not change. Your server does, in three places: how it authenticates, where it sends, and what the payload looks like.

What changes between legacy and v1

Legacy API HTTP v1

Endpoint POST /fcm/send POST /v1/projects/PROJECT_ID/messages:send

Authentication Authorization: key=SERVER_KEY , never expires Authorization: Bearer ACCESS_TOKEN , from a service account, lasts about an hour

Many devices registration_ids with up to 1,000 tokens One target per request: a token, a topic or a condition

Platform options Mixed into one object Separate android , apns and webpush blocks

Data values Any JSON Strings only

Step 1: get a service account key

In the Firebase console open Project settings, Service accounts and generate a new private key.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.