invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.74k stars 2.22k forks source link

[🐛] iOS. Getting MISSING_MFA_PENDING_CREDENTIAL error #8174

Closed BlindDev closed 2 hours ago

BlindDev commented 1 day ago

Issue

Getting error attempting to enroll second factor for a user (iOS, real device):

[Error: [auth/unknown] MISSING_MFA_PENDING_CREDENTIAL : Request does not have MFA pending credential.]

The app has multiple firebase projects setup. Basic authentication with email and password works. But attempting the enroll second factor on a secondary app fails with the error above.

In the firebase logs I see the instance name, the session ID and phone number specified correctly. Also I see that silent push notification was received:

-[RNFBAuthModule verifyPhoneNumberForMultiFactor:::::] [Line 891] verifyPhoneNumberForMultifactor using app: secondary

-[RNFBAuthModule verifyPhoneNumberForMultiFactor:::::] [Line 892] verifyPhoneNumberForMultifactor phoneNumber: +********

-[RNFBAuthModule verifyPhoneNumberForMultiFactor:::::] [Line 893] verifyPhoneNumberForMultifactor sessionId: ********

-[RNFBMessagingAppDelegate application:didReceiveRemoteNotification:fetchCompletionHandler:] [Line 126] didReceiveRemoteNotification Firebase Auth handled the notification with instance: secondary

[Error: [auth/unknown] MISSING_MFA_PENDING_CREDENTIAL : Request does not have MFA pending credential.]

Project Files

Javascript

Click To Expand

#### `package.json`: ```json "@react-native-firebase/analytics": "^19.3.0", "@react-native-firebase/app": "^19.3.0", "@react-native-firebase/auth": "^19.3.0", "@react-native-firebase/crashlytics": "^19.3.0", "@react-native-firebase/dynamic-links": "^19.3.0", "@react-native-firebase/in-app-messaging": "^19.3.0", "@react-native-firebase/installations": "^19.3.0", "@react-native-firebase/messaging": "^19.3.0", "@react-native-firebase/remote-config": "^19.3.0", ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "crashlytics_disable_auto_disabler": true, "google_analytics_automatic_screen_reporting_enabled": false } } ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', __dir__]).strip platform :ios, min_ios_version_supported prepare_react_native_project! flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end # ignore all warnings from all pods inhibit_all_warnings! target 'MyApp' do use_frameworks! :linkage => :static config = use_native_modules! $RNFirebaseAsStaticFramework = true use_react_native!( :path => config[:reactNativePath], :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'MyAppTests' do inherit! :complete # Pods for testing end post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) installer.pods_project.targets.each do |target| if target.name == 'Shake' `xcrun -sdk iphoneos bitcode_strip -r Pods/Shake/Sources/Shake.xcframework/ios-arm64/Shake.framework/Shake -o Pods/Shake/Sources/Shake.xcframework/ios-arm64/Shake.framework/Shake` end end end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.moduleName = @"MyApp"; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; // Firebase configuration [self configureFirebase]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [self getBundleURL]; } - (NSURL *)getBundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [RCTLinkingManager application:application openURL:url options:options]; } - (void)configureFirebase { [FIRApp configure]; ///second config NSLog(@"Firebase public configured"); NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-Dev" ofType:@"plist"]; if (filePath != nil) { FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; if (options != nil) { [FIRApp configureWithName:@"secondary" options:options]; NSLog(@"Firebase secondary configured"); } } } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 14.6.1 CPU: (16) arm64 Apple M3 Max Memory: 403.56 MB / 64.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.9.0 path: /usr/local/bin/node Yarn: Not Found npm: version: 10.2.4 path: /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: Not Found SDKs: iOS SDK: Platforms: - DriverKit 24.1 - iOS 18.1 - macOS 15.1 - tvOS 18.1 - visionOS 2.1 - watchOS 11.1 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.11005911 Xcode: version: 16.1/16B40 path: /usr/bin/xcodebuild Languages: Java: version: 17.0.9 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.73.5 wanted: 0.73.5 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [x] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - 19.3.0 - **`Firebase` module(s) you're using that has the issue:** - @react-native-firebase/auth - **Are you using `TypeScript`?** - Y 5.0.4


mikehardy commented 1 day ago

Please update to current versions and let us know if you still reproduce

BlindDev commented 2 hours ago

Was able to test it on another app with same projects and new libraries. It works. Thank you. Will try to upgrade libs in the main one. I guess we can close this one.