Search code examples
iosflutterfirebase

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


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.


Solution

  • 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