Reputation: 899
I am writing an Android library that be installed on several external apps. This library will have to receive and send Firebase Message from and to my server.
To do that I need to get a FirebaseInstanceId for the app using my library, however a FirebaseInstanceId usage is restricted to the projectId that spawned the InstanceId. Trying to use the Firebase API with an InstanceId created from an app I do not control return a 403.
I tried to manually create a FirebaseApp, setting the apiKey, appId, etc to the values from my own firebase project, but the instanceId I get from that is always null
Is there a way to get a Firebase InstanceID token I can use to send message to other app with my library?
Upvotes: 0
Views: 834
Reputation: 899
Aaand I found the answer less than one hour after...
We can use FirebaseInstanceId.getToken(String authorizedEntity, String scope)
to get a token allowing us to perform firebase operation on another app (ex : set "FCM" in the scope to use the Firebase Cloud Messaging)
Upvotes: 1