We're considering to migrate legacy API to FCM HTTP v1 API to fully utilize FCM functionalities.
Although they provide API Client Library for various programming languages, it could not be possible to cover all programming languages including C++.
Because our push server is written in C++, we decided to implement the protocols. However, we could not find any documents on how to get access token using service-account.json file or server key that can be found in firebase console.
Is there anyone who integrated FCM HTTP v1 API without SDKs that FCM provides?
Firebase Cloud Messaging (FCM), formerly called Google Cloud Messaging (GCM), is a free cloud service from Google that allows app developers to send notifications and messages to users across a variety of platforms, including Android, iOS and web applications.
FCM supports server protocols HTTP and XMPP which are identical to GCM protocols.
Note: In typical migration paths, the FCM v1 API should be enabled by default. If you experience errors contacting the endpoint, double check that the "Firebase Cloud Messaging API" is enabled in the list of APIs and services in the Google Cloud Console.
This increases the security, but also makes it more difficult to use the FCM API because you have to handle the dynamic changes of the tokens. In Legacy FCM we do not have the possibility to send different messages to different platforms in a single request (without distinguishing tokens, treating the registered devices equally).
Currently FCM provides these raw server protocols: Your app server can use these protocols separately or in tandem. Because it is the most up-to-date and most flexible for sending messages to multiple platforms, the FCM HTTP v1 API is recommended wherever feasible.
Because it is the most up-to-date and most flexible for sending messages to multiple platforms, the FCM HTTP v1 API is recommended wherever feasible. If your requirements include upstream messaging from devices to the server, you'll need to implement the XMPP protocol. XMPP messaging differs from HTTP messaging in the following ways:
I figured out the problem.
These articles helped me to implement the protocol in C++. Now it works well. developers.google.com/identity/protocols/oauth2 developers.google.com/identity/protocols/oauth2/service-account
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With