I have SaaS application that needs 4 mobile apps (built in Flutter):
Initially, I was thinking of having a single Firebase project where all 4 apps reside, but I have read that this may not be the best way to handle things (Firebase FCM, multiple apps in the same firebase project).
I have no issues breaking it up to two Firebase projects, one for the customer app and one for the admin app, but how do I then handle this server side when my API is to send pushes?
Server is using .Net, and right now I am using Global.asmx to create the firebase instance:
protected void Application_Start(object sender, EventArgs e)
{
// Enable firebase
FirebaseApp.Create(new AppOptions() { Credential = GoogleCredential.FromFile(HostingEnvironment.MapPath(@"~/App_Data/customerapp-245105.json")).CreateScoped("https://www.googleapis.com/auth/firebase.messaging") });
}
But this will only enable the customer app? How do I also create the admin app?
Im assuming that I can't simply do:
protected void Application_Start(object sender, EventArgs e)
{
// Enable firebase
FirebaseApp.Create(new AppOptions() { Credential = GoogleCredential.FromFile(HostingEnvironment.MapPath(@"~/App_Data/customerapp-245105.json")).CreateScoped("https://www.googleapis.com/auth/firebase.messaging") });
FirebaseApp.Create(new AppOptions() { Credential = GoogleCredential.FromFile(HostingEnvironment.MapPath(@"~/App_Data/adminapp-244405.json")).CreateScoped("https://www.googleapis.com/auth/firebase.messaging") });
}
And, how do I tell the instances apart when calling them in the webservice? As the first instance would be used when sending pushes to customers, and the second for admin?
Each FirebaseApp instance must be given a unique name. You can look up instances by their names. See the examples in the documentation: https://firebase.google.com/docs/admin/setup#initialize_multiple_apps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With