Skip to content

SignInAfterResetPasswordState signIn() discards MFA-required results for continuation-token sign-in #3078

Description

Copilot Usage Confirmation

  • I have tried using GitHub Copilot to resolve this issue.

MSAL Version

Reproduced in 2.11.0, appears to be still present in latest 2.14.1

Description

MSALNativeAuthSignInController.swift,

In signIn(username:grantType:continuationToken:scopes:claimsRequestJson:telemetryId:context:) — the shared controller method used by both SignInAfterSignUpState.signIn() and SignInAfterResetPasswordState.signIn() for continuation-token-based auto-sign-in — has a switch case that discards a valid MFA-required API result instead of surfacing it:

case .awaitingMFA(_, _): let error = SignInAfterSignUpError(type: .generalError, correlationId: context.correlationId()) MSALNativeAuthLogger.log(level: .error, context: context, format: "SignIn: received unexpected MFA required API result") self.stopTelemetryEvent(telemetryInfo.event, context: context, error: error) return .init(.error(error: error), correlationId: context.correlationId())

This treats .awaitingMFA as an unexpected/unsupported outcome and returns a bare generalError with no error codes or message.

This results in the SignInAfterResetPasswordDelegate onSignInAwaitingMFA method not being called and instead onSignInAfterResetPasswordError method is called without any useful error message or codes.

The observed behaviour in the Android MSAL SDK in the same scenario is that it that the sign in result is SignInResult.MFARequired as expected and the sign in flow is able to progress.

Error Details

MSAL.NativeAuthError
errorCodes: 0 values
errorUri: nil
message: "General error"

MSAL Logs

...

Reproduction Steps

Call signIn method from SignInAfterResetPasswordState - knowing MFA is going to be required, expecting that onSignInAwaitingMFA method of SignInAfterResetPasswordDelegate will be called - instead onSignInAfterResetPasswordError method of SignInAfterResetPasswordDelegate is called.

Confirm with debugger breakpoint in MSALNativeAuthSignInController that the .awaitingMFA case is being hit and returning an error.

Expected Behavior

The awaitingMFA case should flow through to the onSignInAwaitingMFA method of SignInAfterResetPasswordDelegate.

Regression

No response

Screenshots & Screen Recordings

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions