Register device on Firebase on server side (Firebase Admin API)

Viewed 749

Start Notes :

When a mobile application starts with Firebase enabled, the first thing that happens is Firebase creates a Token ID for the device on that app.

This requires the device to connect to the Firebase server, and register the device with all the required data about the device.

Unfortunately this cannot happen if the device has blocked access to the Firebase server.


Searches :

As I know, there is a Firebase Admin API on the server side, that can be used to create functions and probably one of them is to create a custom Token ID and register the device using that ID.

However, searching Firebase Docs, only creating a Custom Auth ID appeared

Create Custom Tokens

But this Token ID is not for the device, it is for the user on the device (i.e, Firebase Authentication API).


Goal :

What I want to do, is handle the entire Token ID process from the server side, so that even a Firebase blocked device can be registered on Firebase.


Question :

What is the method of creating a Firebase Token ID on the server that also registers the device as a user with its data (Device Name, OS, etc)?

Is there such a process? Or does Firebase exclusively register the device from the client side?


Side Notes :

I believe it is possible, as some applications that obviously use Firebase Messaging are available for use even when Firebase's access is blocked.

Examples : Discord, Telegram.

1 Answers

The token ID is managed by the client device. The backend and admin SDK are not involved in this process. It's the responsibility of the client app to send this token to you backend, if you need to target the app for use with Cloud Messaging. If the app is temporarily unable to reach your backend, you will have to retry sending the token until it's able to reach the backend.

Related