Copilot Usage Confirmation
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
Copilot Usage Confirmation
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