Add email OTP first-factor sign-in support - #2577
Add email OTP first-factor sign-in support#2577Silviu Petrescu (spetrescu84) wants to merge 4 commits into
Conversation
|
❌ Work item link check failed. Description does not contain AB#{ID}. Click here to Learn more. |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes core authentication state-machine behavior for sign-in (including new first-factor OTP and MFA transitions) and depends on aligned Common changes, which warrants final human verification of end-to-end semantics and compatibility.
Pull request overview
This PR extends MSAL Native Auth V2 sign-in to support email one-time passcode (OTP) as a first factor, mapping Common’s V2 “code required” start responses into the public CodeRequired result and enabling submit/resend code operations using sign-in–specific Public API IDs, with transitions into the existing MFA flow when required.
Changes:
- Map V2 sign-in start
CodeRequiredresults toNativeAuthResultV2.CodeRequiredand expose code metadata (length, target label, channel). - Update
CodeRequiredStateV2to use scenario-specific Public API IDs for submit/resend and supportMFARequiredas a submit-code outcome; reject unsupported scenarios. - Add/extend regression tests covering first-factor code submission, resend, completion, invalid code recovery, and MFA transition behavior.
File summaries
| File | Description |
|---|---|
| msal/src/main/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplication.kt | Maps sign-in start CodeRequired into the public code-required state with email OTP metadata. |
| msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/states/CodeRequiredStateV2.kt | Routes submit/resend to sign-in vs reset-password API IDs, rejects unsupported scenarios, and maps submit-code MFA transitions. |
| msal/src/test/java/com/microsoft/identity/nativeauth/v2/NativeAuthV2SignInTest.kt | Adds parity/regression tests for email OTP first-factor sign-in flows (submit, resend, complete, invalid, MFA transition). |
| msal/src/test/java/com/microsoft/identity/nativeauth/v2/NativeAuthV2InterfaceKotlinTest.kt | Adds coverage ensuring code operations reject unsupported scenarios (sign-up/unknown). |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4c4e8e3 to
0eb026d
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Dependency
Testing
:msal:testLocalDebugUnitTest --tests com.microsoft.identity.nativeauth.v2.NativeAuthV2InterfaceKotlinTest --tests com.microsoft.identity.nativeauth.v2.NativeAuthV2SignInTest