Firebase - Can multiple apps within the same project use the same service account key (push notifications)

Viewed 874

I have a Firebase Project with multiple apps(some iOS, some Android) within it. I'm using Firebase's Cloud Messaging along with the Node.js Firebase Admin SDK to send push notifications to these apps.

To authenticate, I'll set up a service account and generate a keypair for it, and use https://firebase.google.com/docs/reference/admin/node/admin.credential to do the authentication step.

Will this method work for multiple apps? Or will I need to create multiple service accounts and or keys? Also, if I have multiple Node.js API instances, can they all authenticate off the same service account/key simultaneously?

1 Answers

You only need one service account configured per project. It doesn't matter how many apps you have added to that project - you will be able to send messages to any of the devices where any of those apps are installed.

It's up to you to collect the device tokens and make sure you are targeting the correct devices with each push. You might need to create some way to discern which tokens came from which apps, if that matters for your push.

Related