0

If I share a user's Firebase device ID key (for a user who has my app installed) with other Firebase service providers, can they send messages from their account (using their authentication key) to a user who has my app installed?

Yes I do realize the process of sharing a user's Firebase device ID key could be problematic. The problem I am trying to solve is that I want multiple providers to be able to send messages to a user who has my app installed.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

2 Answers2

1

The Firebase Instance ID (also known as a registration token, or FCM token) identifies an installation of your app on a specific device.

Sending messages to such tokens in a project always requires an additional form "authentication.

The Firebase Cloud Messaging versioned REST API requires that the user has a service account. If you create a service account for each of your service providers, you grant them complete access to your Firebase project. So they can't only send FCM messages, they can also access every other Firebase product: e.g. delete your database, read all your users, etc.

The legacy REST API for Firebase Cloud Messaging instead uses a Server Key to authorize its callers. If you share your FCM server key with other service providers, they can only send FCM messages with that key. But they can send whatever messages they want to whatever user.

You might want to consider setting up your own API endpoint on Cloud Functions for Firebase. That way you can determine yourself how to secure that API, and what you allow your service providers to send to what users of your app.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • "You might want to consider setting up your own API endpoint on Cloud Functions for Firebase. That way you can determine yourself how to secure that API, and what you allow your service providers to send to what users of your app." That is the answer. I was hoping there would be a simpler answer within FCM. –  Sep 18 '18 at 18:48
0

Assuming that the Firebase Device ID Key you're referring to is the FCM Registration token, then having the value alone won't enable others to send a message to it without the corresponding Server Key it is associated with.

For your use-case of allowing multiple senders to a single app, you could refer to the official documentation on Receiving messages from multiple senders. I believe my answer here could also be helpful.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • Good reference. Thx! "Note that there is limit of 100 multiple senders." –  Sep 18 '18 at 18:46