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 PR: AzureAD/microsoft-authentication-library-for-android#2380

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

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#2379

---------

Co-authored-by: Mustafa Mizrak <[email protected]>
Copilot AI review requested due to automatic review settings September 18, 2025 13:23
@nilo-ms nilo-ms requested review from a team as code owners September 18, 2025 13:23
@github-actions github-actions bot changed the title Native auth: Email OTP MFA to Match EC Implementation Native auth: 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 SDK to align with the latest EC implementation flow for Email OTP MFA. The key change involves removing the IntrospectRequired response handling and ensuring that MFA flows automatically call the introspect endpoint to retrieve authentication methods, returning them directly to the developer.

  • Removes IntrospectRequired error response handling and related test infrastructure
  • Updates MFA flow to automatically call introspect endpoint when MFA is required
  • Adds MFA_OOB grant type support for Email OTP submissions

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
MockApiResponseType.kt Removes INTROSPECT_REQUIRED enum value
NativeAuthResponseHandlerTest.kt Removes test for IntrospectRequired challenge response
NativeAuthRequestProviderTest.kt Adds test assertions for MFA grant type handling
ApiErrorResponseUtil.kt Removes isIntrospectRequired utility function
SignInChallengeApiResult.kt Removes IntrospectRequired result class
SignInChallengeApiResponse.kt Removes IntrospectRequired response handling logic
SignInTokenRequest.kt Adds MFA grant type parameter and conditional logic
NativeAuthRequestProvider.kt Updates OOB token request creation with MFA grant type
NativeAuthConstants.kt Adds MFA_OOB grant type constant
SignInCommandResult.kt Updates MFARequired result to include auth methods instead of error details
MFACommandResult.kt Removes SelectionRequired result class
SignInSubmitCodeCommandParameters.java Adds isMFAGrantType boolean field
MFASelectedDefaultChallengeCommandParameters.java Removes entire file
MFAChallengeAuthMethodCommandParameters.java Renames and updates class structure
GetAuthMethodsCommandParameters.java Removes entire file
PublicApiId.java Removes unused API ID constants
CommandUtilTest.kt Updates tests for MFA grant type handling
NativeAuthControllerTest.kt Major test refactoring for new MFA flow
SignInOAuthStrategyTest.kt Updates tests and removes IntrospectRequired test
CommandUtil.java Adds MFA grant type handling in utility methods
NativeAuthMsalController.kt Major refactoring of MFA handling logic
MFAChallengeCommand.kt Updates parameter type reference
GetAuthMethodsCommand.kt Removes entire file

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nilo-ms nilo-ms added the Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR label Sep 23, 2025
@nilo-ms nilo-ms merged commit 928aff0 into dev Sep 23, 2025
19 of 20 checks passed
@nilo-ms nilo-ms deleted the feature/mfa-otp branch September 23, 2025 15:51
nilo-ms added a commit to AzureAD/microsoft-authentication-library-for-android that referenced this pull request Sep 24, 2025
…B#3351233 (#2380)

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#2764
shahzaibj added a commit that referenced this pull request Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

native-auth Skip-Consumers-Check Only include this if making a breaking change purposefully, and there is an MSAL/ADAL/Broker PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants