New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MFA_ENROLLMENT_NOT_FOUND on MFA when using Firebase Auth Emulator #11079
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Same issue occurs with react-native-firebase with google-sign-in as first factor:
|
@romansorochak Thanks for the report and reproduction instructions. Would you share a project that demonstrates the issue to help us prioritize it? |
I'm not able to reproduce it using the friendly chat app codelab: curl http://127.0.0.1:9199/emulator/v1/projects/demo-example/verificationCodes {"verificationCodes":[{"code":"339404","phoneNumber":"+14081111111","sessionInfo":"PgzXxZvNnbzJ9U1u4i5L9jGTbSLwzc-A_KTUJ1g36Zimf-88UlU0yGUfRX57aJbl8jcL2_NTP-1-ZgKnljZ3qxPsymMnsdzyU6Ns5sADQK3EwcLylD2XF2t5vXJhApdbg2erPD5b-sb1RYyMIp1m__5rR-B_ijGt547CB5cgtyKvUkf7lraFBEdUOsfNXgFcWJvWDyhzSS10WxfopY8c5LtRRhN4DyoOsk"}]} If I were to guess, the line throwing the error in the emulator is here: |
Hi @paulb777 |
Hi @paulb777 |
@romansorochak Sorry, we haven't been able to get to it yet. I hope to in the next few days. |
@romansorochak We've been able to reproduce the issue and it looks like a bug in the emulator. We will investigate a fix and report back when we have more details. |
Thank you a lot for your help ! |
I also got the repro app running with a real Firebase console project and was able to see a difference in SDK behavior between the emulator and console project. The execution paths diverge at https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseAuth/Sources/AuthProvider/Phone/FIRPhoneAuthProvider.m#L452:
The console project falls through to the StartMFAEnrollmentRequest and sends:
|
Is there a fix planned for this issue? We'd love to be able to test authentication with the emulators but this is blocking us from doing so, even with SDK version 10.24.0. I looked at #12223 and it didn't seem like it fixed this particular bug but perhaps I missed something. |
@dantheli Sorry we haven't been able to prioritize this. In the meantime, please add a thumbs-up to the report above to indicate interest. |
Thanks Paul! I just did some digging myself following your April 20, 2023 findings and I think the underlying issue is this: Emulator throws the error because the client SDK sends the phone number obfuscated, but emulator expects to have a full phone number (obviously). This occurs because if it's connected to the emulator, FIRPhoneAuthProvider as mentioned above will request a verification code using the phone number that the MFA resolver returns in the auth error. The number the MFA resolver returns is obfuscated, which should be expected because the client doesn't need to know the number. I wrote a patch that fixes this by changing the FIRPhoneAuthProvider method to use the same path during emulator as with production, but skipping the app verification call of course. This seems to work. And as far as I can tell, this is what the JS SDK does, where phone MFA verification works fine with the emulator. I've pushed it to a fork. I just put up PR #12874. If I have some more time I'll write some tests, but would love to know if I missed something silly. |
Thanks @dantheli! Please sign the CLA and address other CI issues and we can review. |
Description
We're trying to automate E2E with Firebase Emulators.
On the project we use
Sign in with email/password
, email verification & MFA with phone number.When we create a user with email/password, email verification & MFA through
Firebase Auth Emulator Suite
we are able to login with email/password. But then when we try to proceed with an OTP code we're getting error -MFA_ENROLLMENT_NOT_FOUND
.Reproducing the issue
Firebase
and addiOS
project.email/password
&MFA
.Firebase Auth Emulator
with email/password, email verified, MFA enabled with some phone number.http://0.0.0.0:9099/emulator/v1/projects/{firebase_project_id}/verificationCodes
where thefirebase_project_id
is the id of the firebase project.Expected behaviour
FIRMultiFactorResolver.resolveSignInWithAssertion
should return success.Actual behaviour
FIRMultiFactorResolver.resolveSignInWithAssertion
returns error -MFA_ENROLLMENT_NOT_FOUND
.Firebase SDK Version
10.7.0
Xcode Version
14.2
Installation Method
Carthage
Firebase Product(s)
Authentication
Targeted Platforms
iOS
Relevant Log Output
Error Domain=FIRAuthErrorDomain Code=17084 "MFA_ENROLLMENT_NOT_FOUND" UserInfo={NSLocalizedDescription=MFA_ENROLLMENT_NOT_FOUND, FIRAuthErrorUserInfoNameKey=ERROR_MULTI_FACTOR_INFO_NOT_FOUND}
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetReplace this line with the contents of your Podfile.lock!
The text was updated successfully, but these errors were encountered: