Skip to content
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

Multi factor enrollment failing with internal error if displayName is nil #13856

Closed
alexandersandberg opened this issue Oct 9, 2024 · 3 comments · Fixed by #13858
Closed
Assignees

Comments

@alexandersandberg
Copy link

alexandersandberg commented Oct 9, 2024

Description

When enrolling multi factor, you call the following enroll method:

func enroll(
    with assertion: MultiFactorAssertion,
    displayName: String?
) async throws

The displayName property here is optional.

However, we've noticed after upgrading from 10.24.0 to 11.3.0 that the call errors with an internal error stating "Request contains an invalid argument" if displayName is nil.

If we set displayName to e.g. an empty string "" instead, it works as expected.

Reproducing the issue

let verificationId = ...
let verificationCode = ...

let credential = PhoneAuthProvider.provider().credential(withVerificationID: verificationId, verificationCode: verificationCode)
let assertion = PhoneMultiFactorGenerator.assertion(with: credential)

try await Auth.auth().currentUser?.multiFactor.enroll(with: assertion, displayName: nil) // (1)
try await Auth.auth().currentUser?.multiFactor.enroll(with: assertion, displayName: "") // (2)
  • (1, displayName: nil) fails with internal error "Request contains an invalid argument."
  • (2, displayName: "") works as expected

Firebase SDK Version

11.3.0

Xcode Version

16.0

Installation Method

Swift Package Manager

Firebase Product(s)

Authentication

Targeted Platforms

iOS

Relevant Log Output

Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_INTERNAL_ERROR, NSUnderlyingError=0x3005ac4e0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
    code = 400;
    message = "Request contains an invalid argument.";
    status = "INVALID_ARGUMENT";
}, NSUnderlyingError=0x300594270 {Error Domain=com.google.HTTPStatus Code=400 "(null)" UserInfo={data={length = 127, bytes = 0x7b0a2020 22657272 6f72223a 207b0a20 ... 220a2020 7d0a7d0a }, data_content_type=application/json; charset=UTF-8}}}}, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.}

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@ncooke3
Copy link
Member

ncooke3 commented Oct 9, 2024

Thanks for the report, @alexandersandberg. This was indeed a regression, and will be fixed in the next Firebase release, 11.4.

@alexandersandberg
Copy link
Author

Thank you for fixing this so quickly! 🙏

@firebase firebase locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants