Skip to content

Conversation

@nilo-ms
Copy link
Contributor

@nilo-ms nilo-ms commented Sep 18, 2025

This PR updates the SDK to match the latest flow from EC.

In this new flow, the developer must always supply an auth Method to the /oauth2/v2.0/challenge endpoint which means once the .mfaRequired error is received from token endpoint, the /oauth2/v2.0/introspect endpoint needs to be called to retrieve the methods which are automatically returned to the external developer.

Furthermore, whenever calling the /token endpoint is called with an MFA Email OTP code, the grant type should be mfa_oob

Fixes AB#3351233

MSAL Common PR: AzureAD/microsoft-authentication-library-common-for-android#2764

nilo-ms and others added 3 commits September 18, 2025 13:48
…B#3351233 (#2379)

This PR updates the SDK to match the latest flow from EC.

In this new flow, the developer must always supply an auth Method to the
/oauth2/v2.0/challenge endpoint which means once the .mfaRequired error
is received from token endpoint, the /oauth2/v2.0/introspect endpoint
needs to be called to retrieve the methods which are automatically
returned to the external developer.

Furthermore, whenever calling the /token endpoint is called with an MFA
Email OTP code, the grant type should be mfa_oob

Fixes
[AB#3351233](https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3351233)

MSAL Common PR:
AzureAD/microsoft-authentication-library-common-for-android#2760
Copilot AI review requested due to automatic review settings September 18, 2025 13:25
@nilo-ms nilo-ms requested review from a team as code owners September 18, 2025 13:25
@github-actions github-actions bot added the msal label Sep 18, 2025
@github-actions github-actions bot changed the title Native auth: Update Email OTP MFA to Match EC Implementation Native auth: Update Email OTP MFA to Match EC Implementation, Fixes AB#3351233 Sep 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Native Auth MFA flow to align with the latest EC implementation. The key change requires developers to always supply an auth method when calling the challenge endpoint, eliminating the previous pattern of calling challenge without parameters and then using getAuthMethods().

  • Removes the intermediate getAuthMethods() API call flow that was previously used in MFA scenarios
  • Updates all MFA requestChallenge calls to require an AuthMethod parameter instead of being optional
  • Simplifies test scenarios by directly using auth methods returned from the MFA required state

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
NativeAuthPublicClientApplicationKotlinTest.kt Removes complex multi-step MFA test scenarios and updates remaining tests to use auth methods from MFA result
NativeAuthPublicClientApplicationJavaTest.java Consolidates MFA test scenarios and removes getAuthMethods callback implementation
SignInMFATest.kt Simplifies E2E MFA tests by removing getAuthMethods flow and unused imports
SignInStates.kt Adds authMethods to MFARequired result construction
MFAStates.kt Removes getAuthMethods API and makes authMethod parameter required for requestChallenge
SignInResult.kt Adds authMethods property to MFARequired result class
MFAResult.kt Removes SelectionRequired result and MFAGetAuthMethodsResult interface
MFAErrors.kt Removes MFAGetAuthMethodsError class
NativeAuthPublicClientApplication.kt Adds authMethods to MFARequired result construction
CommandParametersAdapter.java Removes getAuthMethods and default challenge command parameters, renames selected challenge parameters
common Updates submodule reference for MSAL Common changes

nilo-ms added a commit to AzureAD/microsoft-authentication-library-common-for-android that referenced this pull request Sep 23, 2025
…33 (#2764)

This PR updates the SDK to match the latest flow from EC.

In this new flow, the developer must always supply an auth Method to the
/oauth2/v2.0/challenge endpoint which means once the .mfaRequired error
is received from token endpoint, the /oauth2/v2.0/introspect endpoint
needs to be called to retrieve the methods which are automatically
returned to the external developer.

Furthermore, whenever calling the /token endpoint is called with an MFA
Email OTP code, the grant type should be mfa_oob

Fixes
[AB#3351233](https://identitydivision.visualstudio.com/Engineering/_workitems/edit/3351233)

MSAL PR:
AzureAD/microsoft-authentication-library-for-android#2380

---------

Co-authored-by: Mustafa Mizrak <[email protected]>
@nilo-ms nilo-ms merged commit 6d1c787 into dev Sep 24, 2025
13 of 14 checks passed
@nilo-ms nilo-ms deleted the feature/email-otp-mfa branch September 24, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants