invertase / invertase/react-native-firebase

[🐛] Auth iOS verifyPhoneNumberWithMultiFactorInfo invalid-phone-number error

Open
#7,546 11 comments 0 reactions 0 assignees View on GitHub
blocked: firebase-sdk Keep Open platform: ios plugin: authentication type: bug
Dominant language
TypeScript
Stars
12.3k
Forks
2.3k
Avg merge
3d 3h
Merged PRs (30d)
79

Description

**RN**: 0.72.7
**RNFB**: 18.7.3
**iOS**: 17.x

There appears to be an issue with the decoding of the MultifactorInfo on iOS when performing the MFA sign-in flow, this code is working on Android, but on iOS it appears that the phone number coming over is formatted as `+*******1234` and in turn is throwing the invalid-phone-number error when calling the verifyPhoneNumberWithMultiFactorInfo method.

Tested on device and simulator with the same result.

The code below is based on the official documentation from here: https://rnfirebase.io/auth/multi-factor-auth

```javascript
const mfaResolver = auth().getMultiFactorResolver(error);
if (mfaResolver?.hints[0].factorId === auth.PhoneMultiFactorGenerator.FACTOR_ID) {
const hint = mfaResolver.hints[0];
const sessId = mfaResolver.session;
auth()
.verifyPhoneNumberWithMultiFactorInfo(hint, sessId)
.then((vId) => {
setVerificationId(vId);
setMfaResolver(mfaResolver);
setShowVerificationForm(true);
})
}
```

Ideas or assistance is appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.