olucurious / PyFCM

Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)

Home Page:http://olucurious.github.io/PyFCM/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrate from legacy FCM APIs to HTTP v1

jhonsoto-aflore opened this issue · comments

FCM_END_POINT = "https://fcm.googleapis.com/fcm/send"

Apps using the deprecated FCM legacy APIs for HTTP and XMPP should migrate to the HTTP v1 API at the earliest opportunity. Sending messages (including upstream messages) with those APIs was deprecated on June 20, 2023, and will be removed on June 21, 2024.

HTTP requests before:
POST https://fcm.googleapis.com/fcm/send

After:
POST https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send

@jhonsoto-aflore
#321
It seems like updated version will be released soon.

@olucurious It doesn't work, migration is not completed. I have a fork where I fixed all the issues. I can do a PR if the author is not gonna complete the migration.

Please send a PR then

@olucurious Sorry for the confusion. I was referring to the version #319. I just realized you already made the fix in 2.x version. I made almost identical changes a few days ago to make it work. The primary difference is I kept the backward compatibility.

I have one minor comment regarding your version. The FCM token has a 24-hour lifetime, so there is no need to refresh it that often (every 30 minutes).

Another possible improvement is obtaining the project ID from the service account key JSON file (project_id attribute) instead of requiring it to be passed as a constructor argument.