firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Firebase MFA: isAppVerificationDisabledForTesting is not working

Open romansorochak opened this issue 2 years ago • 8 comments

Step 0: Are you in the right place?

Having issue with isAppVerificationDisabledForTesting flag.

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 13.3
  • Firebase SDK version: 8.13.0
  • Installation method: Swift Package Manager
  • Firebase Component: Auth
  • Target platform(s): iOS

[REQUIRED] Step 2: Describe the problem

I'm trying to write UI/Integration testing to login with with Firebase MFA where first step is login with email/password and second as phone number / OTP. When I set a flag Auth.auth().settings?.isAppVerificationDisabledForTesting = true after verifyPhoneNumber it throws me an error below.

Error Domain=FIRAuthErrorDomain Code=17042 "Invalid format."
UserInfo={NSLocalizedDescription=Invalid format., 
FIRAuthErrorUserInfoNameKey=ERROR_INVALID_PHONE_NUMBER}

I use fictional phone number +16505554567 / 123356 and added it to the test phone numbers section in Firebase console. I also tried to use real phone number. (didn't help)

Steps to reproduce:

  1. Enable MFA in Identity Platform.
  2. Enable email/password provider.
  3. Enable phone number / OTP provider.
  4. Add fictional phone number under test phone numbers - +16505554567 / 123356
  5. Then create user with email/password.
  6. Verify email
  7. Enrol 2 step authentication as phone number / OTP - +16505554567
  8. Then (on another device or simulator) enable Auth.auth().settings?.isAppVerificationDisabledForTesting = true
  9. Login with email/password
  10. Then try to complete required second step with +16505554567 Expected behaviour It should proceed and ask for OTP code. Actual behaviour It throws error:
Error Domain=FIRAuthErrorDomain Code=17042 "Invalid format."
UserInfo={NSLocalizedDescription=Invalid format., 
FIRAuthErrorUserInfoNameKey=ERROR_INVALID_PHONE_NUMBER}

Without flag Auth.auth().settings?.isAppVerificationDisabledForTesting = true it works as expected. Though it is not possible to write UI Testing due to reCaptcha.

romansorochak avatar Apr 02 '22 12:04 romansorochak

Thanks for reporting, @romansorochak. Is the issue only reproducible on UI/integration testing? I'm unable to get the same error using the Auth Quickstart (though I haven't tried on UI testing).

rizafran avatar Apr 04 '22 20:04 rizafran

@rizafran Thanks. This issue appears when login with 2FA. It doesn't matter wether I try to perform steps below manually or with UI/Integration testing.

  1. step is to login with email/password.
  2. then as a 2 step trying to verify phone number
Auth.auth().settings?.isAppVerificationDisabledForTesting = true

PhoneAuthProvider.provider().verifyPhoneNumber(
  with: hint,
  uiDelegate: nil,
  multiFactorSession: multiFactorSession,
  completion: completion
)

in completion I receive error as below

Error Domain=FIRAuthErrorDomain Code=17042 "Invalid format."
UserInfo={NSLocalizedDescription=Invalid format., 
FIRAuthErrorUserInfoNameKey=ERROR_INVALID_PHONE_NUMBER}

romansorochak avatar Apr 05 '22 14:04 romansorochak

Hi, thanks for filing this issue! We are unable to promise any timeline for this, but if others also have this issue, adding a +1 on this issue can help us prioritize adding this to the roadmap.

(Googler-only internal tracking bug: b/228617084)

lisajian avatar Apr 08 '22 18:04 lisajian

@lisajian, @rizafran +1

oleksandr-kozlovskyi avatar Apr 11 '22 12:04 oleksandr-kozlovskyi

+1

RuslanKharkevych avatar Apr 11 '22 12:04 RuslanKharkevych

+1

Stypanovych avatar Apr 11 '22 12:04 Stypanovych

+1

gabediazm avatar Apr 11 '22 13:04 gabediazm

+1

jgrosjean-petale avatar Jul 26 '22 14:07 jgrosjean-petale