Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FCM http v1 API integration for servers using programming languages including c++ that does not have SDK supports

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?

like image 203
jwchoi Avatar asked May 28 '20 04:05

jwchoi


People also ask

What is FCM used for?

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.

What protocol does FCM use?

FCM supports server protocols HTTP and XMPP which are identical to GCM protocols.

Is the FCM V1 API enabled by default?

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.

Why is legacy FCM more difficult to use than the API?

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).

What raw server protocols does FCM provide?

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.

Which HTTP V1 API should I use to send messages?

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:


1 Answers

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

like image 55
jwchoi Avatar answered Oct 17 '22 13:10

jwchoi