ios – Why Firebase isAppVerificationDisabledForTesting Flag just isn’t working?

0
1
ios – Why Firebase isAppVerificationDisabledForTesting Flag just isn’t working?


We’re experiencing inconsistent points with the Auth.auth().settings?.isAppVerificationDisabledForTesting = true flag in our testing surroundings. Though we preserve the SPM up to date, the error happens intermittently with none code adjustments. For this testing surroundings, we observe this firebase information.

The newest subject happens throughout code verification, which returns the error proven beneath. The verification ID is nil, although we’re setting it to an empty string.

The telephone auth credential was created with an empty verification ID.

Under are the primary features we use to register/sign up a person with a telephone quantity.

/// Referred to as the perform to despatched verification code
func sentVerificationCode(to telephone: String) async throws {
    // That is our testing surroundings 
    #if DEV
        Auth.auth().settings?.isAppVerificationDisabledForTesting = true
    #endif
        
    do {
       let verificationID = strive await PhoneAuthProvider.supplier().verifyPhoneNumber(phoneNumber, uiDelegate: nil)
       UserDefaultsStorage.shared.set(key: .phoneVerificationId, string: verificationID)
       return
    } catch {
       throw error
    }
}

/// Referred to as to create the person with the verification code that was obtained
func createUser(with verificationCode: String, telephone: String) async throws {
    // 1 - Get VerificationID
    var verificationID: String? = UserDefaultsStorage.shared.getString(for: .phoneVerificationId)
    #if DEV
    // For DEV we're eradicating the verification utilizing `Auth.auth().settings?.isAppVerificationDisabledForTesting = true`. Which means that the verification code can be nil, so we have to set it to an empty string.
    verificationID = verificationID ?? ""
    #endif

    // 2 - Create credentials
    let credentials = PhoneAuthProvider.supplier().credential(withVerificationID: verificationID, verificationCode: verificationCode)
    // 3 - Sign up
    do {
       let consequence = strive await Auth.auth().signIn(with: credentials)
    } catch let error {
       // Is right here the place Im receiving the error talked about above.
       throw error
    }
}

I’ve examined in a simulator and actual system and the identical consequence.

Testing info:

  • Simulator: iPhone 16 – OS 18.1
  • Actual system: iPhone 13 – OS 18.3.2
  • Xcode 16.3

LEAVE A REPLY

Please enter your comment!
Please enter your name here