From a1e4c9cf5c9e2e2cab9a0aa518d256513dcaf170 Mon Sep 17 00:00:00 2001 From: Pavan Shankar Date: Tue, 7 Jan 2025 09:26:38 +0530 Subject: [PATCH 1/3] Update RCE flow to skip checking status if appVerificationDisabledForTesting is set --- .../Swift/AuthProvider/PhoneAuthProvider.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift index 8c7a6982fd4..e2db7c6339b 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift +++ b/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) { From 88d3408d0600aec61a11abddc76855040cd07c74 Mon Sep 17 00:00:00 2001 From: Pavan Shankar Date: Tue, 7 Jan 2025 09:34:47 +0530 Subject: [PATCH 2/3] Fix style --- .../Sources/Swift/AuthProvider/PhoneAuthProvider.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift index e2db7c6339b..61e5693f374 100644 --- a/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift +++ b/FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift @@ -203,13 +203,13 @@ 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, @@ -217,7 +217,7 @@ import Foundation uiDelegate: uiDelegate ) } - + try await recaptchaVerifier.retrieveRecaptchaConfig(forceRefresh: true) switch recaptchaVerifier.enablementStatus(forProvider: .phone) { From 4a88845c96aab250f66b142cd8622771c10934ed Mon Sep 17 00:00:00 2001 From: Pavan Shankar Date: Tue, 7 Jan 2025 09:40:59 +0530 Subject: [PATCH 3/3] Add changelog --- FirebaseAuth/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/FirebaseAuth/CHANGELOG.md b/FirebaseAuth/CHANGELOG.md index bce9975d100..197eb157087 100644 --- a/FirebaseAuth/CHANGELOG.md +++ b/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