firebase / firebase/firebase-ios-sdk
Firebase MFA: isAppVerificationDisabledForTesting is not working
- Dominant language
- C++
- Stars
- 6.7k
- Forks
- 1.8k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### 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.
Contributor guide
Assessment
This issue has not been assessed yet.