Browse Source

Update RCE flow to skip checking status if appVerificationDisabledForTesting is set (#14310)

Pavan Shankar 1 năm trước cách đây
mục cha
commit
ed5ea20547

+ 1 - 0
FirebaseAuth/CHANGELOG.md

@@ -4,6 +4,7 @@
   for decoding `nil` values. (#14212)
 - [fixed] Address Xcode 16.2 concurrency compile time issues. (#14279)
 - [fixed] Fix handling of cloud blocking function errors. (#14052)
+- [fixed] Fix phone auth flow to skip RCE verification if appVerificationDisabledForTesting is set. (#14242)
 
 # 11.6.0
 - [added] Added reCAPTCHA Enterprise support for app verification during phone

+ 15 - 0
FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift

@@ -203,6 +203,21 @@ import Foundation
       }
 
       let recaptchaVerifier = AuthRecaptchaVerifier.shared(auth: auth)
+
+      if let settings = auth.settings,
+         settings.isAppVerificationDisabledForTesting {
+        // If app verification is disabled for testing
+        // do not fetch recaptcha config, as this is not implemented in emulator
+        // Treat this same as RCE enable status off
+
+        return try await verifyClAndSendVerificationCode(
+          toPhoneNumber: phoneNumber,
+          retryOnInvalidAppCredential: true,
+          multiFactorSession: multiFactorSession,
+          uiDelegate: uiDelegate
+        )
+      }
+
       try await recaptchaVerifier.retrieveRecaptchaConfig(forceRefresh: true)
 
       switch recaptchaVerifier.enablementStatus(forProvider: .phone) {