firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.63k stars 3.95k forks source link

🐛 [firebase_auth] Runtime switch of firebase project is not working in iOS real device. #11425

Closed chtnsngh closed 1 year ago

chtnsngh commented 1 year ago

Bug report

Issue Description I have a usecase where I have to switch from one firebase project to another at runtime. Initially I am setting up firebase app with the live project like this

var app =  await Firebase.initializeApp(
      name: live,
      options:  live_firebase.DefaultFirebaseOptions.currentPlatform
    );

At a certain point in signin flow, when a user enters a specific test number, I have to migrate to sandbox app so I am initializing the sandbox project like this

var app =  await Firebase.initializeApp(
      name: sandbox,
      options:  sandbox_firebase.DefaultFirebaseOptions.currentPlatform
    );

This is working perfectly fine in Android Emulator and real device. But in IOS platform, this migration is working fine in simulator but not in real device. This means in IOS Re-Captcha flow is working but silent push notification is failing in app verification flow.

Note- Both the ios app configured in different firebase project are part of same app store account, hence a same APNS key is configured for both the ios apps in different project.

dependencies used -> pubspec.yaml

  firebase_core: ^2.15.0
  firebase_auth: ^4.7.1
  firebase_core_platform_interface: ^4.8.0
  firebase_app_installations: ^0.2.3+4
  cloud_firestore: ^4.8.3
  firebase_remote_config: ^4.2.4
  firebase_analytics: ^10.4.4
  firebase_crashlytics: ^3.3.4

Podfile.lock

- cloud_firestore (4.8.3):
    - Firebase/Firestore (= 10.12.0)
    - firebase_core
    - Flutter
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - Firebase/Analytics (10.12.0):
    - Firebase/Core
  - Firebase/Auth (10.12.0):
    - Firebase/CoreOnly
    - FirebaseAuth (~> 10.12.0)
  - Firebase/Core (10.12.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (~> 10.12.0)
  - Firebase/CoreOnly (10.12.0):
    - FirebaseCore (= 10.12.0)
  - Firebase/Crashlytics (10.12.0):
    - Firebase/CoreOnly
    - FirebaseCrashlytics (~> 10.12.0)
  - Firebase/DynamicLinks (10.12.0):
    - Firebase/CoreOnly
    - FirebaseDynamicLinks (~> 10.12.0)
  - Firebase/Firestore (10.12.0):
    - Firebase/CoreOnly
    - FirebaseFirestore (~> 10.12.0)
  - Firebase/Installations (10.12.0):
    - Firebase/CoreOnly
    - FirebaseInstallations (~> 10.12.0)
  - Firebase/Performance (10.12.0):
    - Firebase/CoreOnly
    - FirebasePerformance (~> 10.12.0)
  - Firebase/RemoteConfig (10.12.0):
    - Firebase/CoreOnly
    - FirebaseRemoteConfig (~> 10.12.0)
  - Firebase/Storage (10.12.0):
    - Firebase/CoreOnly
    - FirebaseStorage (~> 10.12.0)
  - firebase_analytics (10.4.4):
    - Firebase/Analytics (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_app_installations (0.2.3-4):
    - Firebase/Installations (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_auth (4.7.1):
    - Firebase/Auth (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_core (2.15.0):
    - Firebase/CoreOnly (= 10.12.0)
    - Flutter
  - firebase_crashlytics (3.3.4):
    - Firebase/Crashlytics (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_dynamic_links (5.3.4):
    - Firebase/DynamicLinks (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_performance (0.9.2-4):
    - Firebase/Performance (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_remote_config (4.2.4):
    - Firebase/RemoteConfig (= 10.12.0)
    - firebase_core
    - Flutter
  - firebase_storage (11.2.5):
    - Firebase/Storage (= 10.12.0)
    - firebase_core
    - Flutter
  - FirebaseABTesting (10.12.0):
    - FirebaseCore (~> 10.0)
  - FirebaseAnalytics (10.12.0):
    - FirebaseAnalytics/AdIdSupport (= 10.12.0)
    - FirebaseCore (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.11)
    - GoogleUtilities/MethodSwizzler (~> 7.11)
    - GoogleUtilities/Network (~> 7.11)
    - "GoogleUtilities/NSData+zlib (~> 7.11)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - FirebaseAnalytics/AdIdSupport (10.12.0):
    - FirebaseCore (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleAppMeasurement (= 10.12.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.11)
    - GoogleUtilities/MethodSwizzler (~> 7.11)
    - GoogleUtilities/Network (~> 7.11)
    - "GoogleUtilities/NSData+zlib (~> 7.11)"
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - FirebaseAppCheckInterop (10.12.0)
  - FirebaseAuth (10.12.0):
    - FirebaseAppCheckInterop (~> 10.0)
    - FirebaseCore (~> 10.0)
    - GoogleUtilities/AppDelegateSwizzler (~> 7.8)
    - GoogleUtilities/Environment (~> 7.8)
    - GTMSessionFetcher/Core (< 4.0, >= 2.1)
  - FirebaseAuthInterop (10.12.0)
  - FirebaseCore (10.12.0):
    - FirebaseCoreInternal (~> 10.0)
    - GoogleUtilities/Environment (~> 7.8)
    - GoogleUtilities/Logger (~> 7.8)
  - FirebaseCoreExtension (10.12.0):
    - FirebaseCore (~> 10.0)
  - FirebaseCoreInternal (10.12.0):
    - "GoogleUtilities/NSData+zlib (~> 7.8)"
  - FirebaseCrashlytics (10.12.0):
    - FirebaseCore (~> 10.5)
    - FirebaseInstallations (~> 10.0)
    - FirebaseSessions (~> 10.5)
    - GoogleDataTransport (~> 9.2)
    - GoogleUtilities/Environment (~> 7.8)
    - nanopb (< 2.30910.0, >= 2.30908.0)
    - PromisesObjC (~> 2.1)
  - FirebaseDynamicLinks (10.12.0):
    - FirebaseCore (~> 10.0)
  - FirebaseFirestore (10.12.0):
    - FirebaseFirestore/AutodetectLeveldb (= 10.12.0)
  - FirebaseFirestore/AutodetectLeveldb (10.12.0):
    - FirebaseFirestore/Base
    - FirebaseFirestore/WithLeveldb
  - FirebaseFirestore/Base (10.12.0)
  - FirebaseFirestore/WithLeveldb (10.12.0):
    - FirebaseFirestore/Base
  - FirebaseInstallations (10.12.0):
    - FirebaseCore (~> 10.0)
    - GoogleUtilities/Environment (~> 7.8)
    - GoogleUtilities/UserDefaults (~> 7.8)
    - PromisesObjC (~> 2.1)
  - FirebasePerformance (10.12.0):
    - FirebaseCore (~> 10.5)
    - FirebaseInstallations (~> 10.0)
    - FirebaseRemoteConfig (~> 10.0)
    - FirebaseSessions (~> 10.5)
    - GoogleDataTransport (~> 9.2)
    - GoogleUtilities/Environment (~> 7.8)
    - GoogleUtilities/ISASwizzler (~> 7.8)
    - GoogleUtilities/MethodSwizzler (~> 7.8)
    - nanopb (< 2.30910.0, >= 2.30908.0)
  - FirebaseRemoteConfig (10.12.0):
    - FirebaseABTesting (~> 10.0)
    - FirebaseCore (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleUtilities/Environment (~> 7.8)
    - "GoogleUtilities/NSData+zlib (~> 7.8)"
  - FirebaseSessions (10.12.0):
    - FirebaseCore (~> 10.5)
    - FirebaseCoreExtension (~> 10.0)
    - FirebaseInstallations (~> 10.0)
    - GoogleDataTransport (~> 9.2)
    - GoogleUtilities/Environment (~> 7.10)
    - nanopb (< 2.30910.0, >= 2.30908.0)
    - PromisesSwift (~> 2.1)
  - FirebaseStorage (10.12.0):
    - FirebaseAppCheckInterop (~> 10.0)
    - FirebaseAuthInterop (~> 10.0)
    - FirebaseCore (~> 10.0)
    - FirebaseCoreExtension (~> 10.0)
    - GTMSessionFetcher/Core (< 4.0, >= 2.1)

Do I need to do any extra step in order to achieve this migration in flutter ? I followed this documentation which provides details for native apps.

darshankawar commented 1 year ago

@chtnsngh If the setup is working properly for iOS simulator but not for physical device, then it probably indicates that the behavior for iOS you are seeing may not be due to plugin code itself, as the plugin code doesn't differentiate between device types, it is same for all platforms. Also, flutterfire plugins are thin wrappers around native Firebase sdks, so the runtime switch of the firebase project you are doing may not be in flutterfire's control, but would like to know how are you initializing your firebase app ? Is it through flutterfire configure CLI ?

I suggest you to reach out to firebase support for your use case.

google-oss-bot commented 1 year ago

Hey @chtnsngh. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 year ago

Since there haven't been any recent updates here, I am going to close this issue.

@chtnsngh if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.