Secondary Apps: Using Phone Auth on a Firebase project with multiple apps

I have a Firebase project running multiple Android flavors (of my Flutter app). Since phone auth requires adding SHA-1 fingerprints and you can add a maximum of 36, Firebase throwed some error while adding more SHA-1. To get around it, I came across Secondary Firebase Apps.

So, in my current setup, I have a Base App containing all SHA-1 fingerprints (debug and release) and multiple Flavor 1, Flavor 2, etc apps with no fingerprints.

I am using the google-service.json file from Flavor 1(app without any SHA-1) as my Primary Firebase App so that I can use Analytics and Crashlytics properly and using the Base App(with all fingerprints) as the Secondary App for Phone Auth. But this setup is throwing the SafetyNet (ReCaptcha) error that indicates my app is missing the SHA-1.

Here is the code of my initialization before calling runApp()

await Firebase.initializeApp();
FirebaseOptions options = FirebaseOptions(
    projectId: "projectid",
    appId: "appid",
    apiKey: "currentkey",
    messagingSenderId: "senderid",
    authDomain: "authdomain"
);
await Firebase.initializeApp(name: "secondaryapp", options: options);

How can I correctly setup for phone auth to work? I am looking for a setup where I need to provide SHA-1 just in the Base App.



Read more here: https://stackoverflow.com/questions/67015123/secondary-apps-using-phone-auth-on-a-firebase-project-with-multiple-apps

Content Attribution

This content was originally published by Michael Hathi at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: