CLIENT_ID missing from GoogleService-Info.plist with Firebase on IOS in a flutter app
Asked Answered
K

2

8

I'm trying to configure Firebase on a flutter mobile app. I have two flavors (prod and preprod) in my app, so I created two Firebase apps, one for each flavor for the prod flavor everything works fine. However for the preprod flavor on IOS I get this error :

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists
#0      MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:134:11)
<asynchronous suspension>
#1      Firebase.initializeApp (package:firebase_core/src/firebase.dart:43:31)
<asynchronous suspension>
#2      start (package:hexatrip_mobile_app/main_preprod.dart:24:3)

The only difference I see between both flavors is that the GoogleService-Info.plist that I download for the preprod Firebase app does not contains those keys : CLIENT_ID and REVERSED_CLIENT_ID I suspect that the absence of those keys is responsible for the error but I can't find why they would be missing.

Thank you.

Keeton answered 22/9, 2023 at 21:3 Comment(1)
Find any solutions?West
B
16

for all those who had this problem if you downloaded GoogleServices-Info.plist file and it doesn't contain CLIENT_ID and REVERSE_CLIENT_ID

Solution:

Just Go to Authentication section in firebase -> Sign-in method -> Add new provider then select Google and enable it .

sample_firebase_auth

now download the updated GoogleService-Info.plist file now it had the CLIENT_ID and REVERSE_CLIENT_ID then replace the old one with updated one. Thanks

Bogosian answered 5/10, 2023 at 9:9 Comment(3)
@ErikA done with editing . thanksBogosian
@ZakwanIbrahim I've removed the comment and my vote to delete. The review is still ungoing, I hope future reviewers will vote to leave this open.Casares
It was a little difficult to find the sign-in settings in the Firebase console, but once I did I was able to generate a new GoogleServices-Info.plist file and it now has CLIENT_ID and REVERSE_CLIENT_ID values. Thank you @ZakwanIbrahim!Rexer
M
0

Here I see in Firebase, if we only give the SHA-1 key, then it does not generate the correct google-services.json file, and it does not contain the client id.

So for generating the correct google-services.json file, add both the SHA-1 key and SHA-256 key and afterwords download the google-services.json file.

Midwife answered 30/8, 2024 at 15:40 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.