Skip to content

Unify Native Auth V2 errors and stable classifiers, Fixes AB#3784695 - #2618

Merged
Silviu Petrescu (spetrescu84) merged 8 commits into
devfrom
djanardhan/native-auth-v2-unified-errors
Oct 19, 2026
Merged

Silviu Petrescu (spetrescu84) merged 8 commits into
devfrom
djanardhan/native-auth-v2-unified-errors

Conversation

@djanardhan98

@djanardhan98 Disha Janardhan (djanardhan98) commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Unify Native Auth V2 terminal errors under NativeAuthErrorV2, matching AzureAD/microsoft-authentication-library-for-js#8900.

  • Remove the operation-specific V2 error classes without deprecated compatibility wrappers.
  • Expose stable classifiers on the shared error, distinguishing rejected credentials from new-password policy failures and invalid input.
  • Preserve service diagnostics, correlation, exceptions, and recoverable attribute-validation state.
  • Keep Native Auth V1 behavior unchanged.

Breaking V2 API change: replace operation-specific error type checks with NativeAuthErrorV2 and its classifiers.

Fixes AB#3784695

Dependencies

Requires the paired Common unified-error diagnostics PR: AzureAD/microsoft-authentication-library-common-for-android#3307.
The Common gitlink points to 3265533f27d8c4054fc5b020ec0228bb872b8344.
Scopes/claims and OTP-service-validation changes are intentionally excluded.

Validation

Errors-only snapshot: 651 selected unit tests passed (215 MSAL, 346 Common4j, 90 Common Android), with zero failures, errors, or skips in the final XML reports.
The gate includes shared classifiers, wrong-password versus invalid-input mappings, diagnostic propagation, and standalone V1 regression coverage.
Final integrated-stack PR2601 validation: 20 live signup/reset E2E tests and 4 recorder tests passed, with 3 known duplicate-account service-test skips. One Mail.tm /accounts HTTP 429 attempt passed on the existing automatic retry; no assertions or retry configuration were changed.
Live validation was executed against the final stacked errors plus scopes/claims sources, not the standalone errors snapshot.

The live fixture overlay comes from #2601 and is not included in this feature PR.

Fixes AB#3784695

Remove operation-specific V2 error classes without deprecated wrappers. Preserve recoverable states and raw diagnostics; distinguish credentials from new-password policy. Pair with the Common diagnostic-propagation commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784695

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Fixes AB#3784695

Rejected credentials are invalid credentials; empty password input is invalid input. Use independently validated Common diagnostic-forwarding repair.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
@github-actions

Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3784695 to an Azure Boards work item.

@github-actions github-actions Bot changed the title Unify Native Auth V2 errors and stable classifiers Unify Native Auth V2 errors and stable classifiers, Fixes AB#3784695 Oct 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Exposed mutable validation diagnostics undermine classifier stability, and public sign-up documentation contradicts the returned-error contract.

2 open findings
What changed in this PR

Unifies Native Auth V2 failures under NativeAuthErrorV2, preserving diagnostics and adding stable classifiers alongside recoverable attribute-validation state.

Changes:

  • Replaces operation-specific V2 error classes and mappings with one shared error.
  • Adds diagnostic propagation and credential, password-policy, input, and attribute classifiers.
  • Updates unit, Java interoperability, and E2E coverage for the new contract.
File Description
changelog Documents the breaking V2 error change.
INativeAuthPublicClientApplication.kt Updates reset-password error documentation.
NativeAuthPublicClientApplication.kt Maps entry-point failures to the shared error.
CodeErrorsV2.kt Removes the submit-code error class.
JITErrorsV2.kt Removes JIT-specific V2 errors.
MFAErrorsV2.kt Removes MFA-specific V2 errors.
NativeAuthErrorV2.kt Adds unified diagnostics and classifiers.
ResetPasswordErrorsV2.kt Removes reset-password-specific errors.
SignInErrorsV2.kt Removes sign-in-specific errors.
SignUpErrorsV2.kt Removes sign-up-specific errors.
NativeAuthResultV2.kt Adds diagnostics to recoverable attribute failures.
AttributesRequiredStateV2.kt Uses unified attribute errors.
CodeRequiredStateV2.kt Uses unified code errors.
MFARequiredStateV2.kt Uses unified MFA-selection errors.
MFAVerificationRequiredStateV2.kt Uses unified challenge errors.
NewPasswordRequiredStateV2.kt Uses unified password-policy errors.
PasswordRequiredStateV2.kt Separates credential and password-policy classifications.
ResetPasswordMethodRequiredStateV2.kt Uses unified method-selection errors.
SignInAfterResetPasswordStateV2.kt Preserves API diagnostics.
SignInAfterSignUpStateV2.kt Preserves API diagnostics.
SignInV2EmailPasswordTest.kt Updates live sign-in expectations.
NativeAuthV2ErrorsTest.kt Tests shared classifiers and diagnostics.
NativeAuthV2InterfaceJavaTest.java Updates Java type checks.
NativeAuthV2InterfaceKotlinTest.kt Updates reset-password tests.
NativeAuthV2SignInTest.kt Updates sign-in and MFA tests.
NativeAuthV2SignUpTest.kt Updates sign-up and attribute tests.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Preserve service trace IDs, timestamps, and numeric codes across V2 public error mappings. Keep password-policy classification independent of credential classification, correct sign-up documentation, and pair the updated Common commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
@djanardhan98 Disha Janardhan (djanardhan98) added the changelog:none No changelog entry or version increment is required. label Oct 16, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
@djanardhan98
Disha Janardhan (djanardhan98) marked this pull request as ready for review October 16, 2026 19:21
Silviu Petrescu (spetrescu84) pushed a commit to AzureAD/microsoft-authentication-library-common-for-android that referenced this pull request Oct 19, 2026
…3307)

## Summary

Preserve Common diagnostics needed by the shared Android Native Auth V2
error surface, matching
AzureAD/microsoft-authentication-library-for-js#8900.

- Retain suberrors and attribute-validation details in V2 API,
interaction, and command results.
- Forward those diagnostics through V2 controllers and preserve unknown
service errors.
- Use additive, defaulted diagnostic fields and preserve V1 behavior.

Fixes
[AB#3784695](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3784695)

## Dependencies

Consumed by the paired MSAL unified-errors PR:
AzureAD/microsoft-authentication-library-for-android#2618.
Authorize-request scopes/claims changes are intentionally excluded.

## Validation

Errors-only snapshot: **651 selected unit tests passed** (215 MSAL, 346
Common4j, 90 Common Android), with zero failures, errors, or skips in
the final XML reports.
The gate includes diagnostic parsing/forwarding and standalone V1
regression coverage.
Final integrated-stack PR2601 validation: **20 live signup/reset E2E
tests and 4 recorder tests passed**, with 3 known duplicate-account
service-test skips. One Mail.tm `/accounts` HTTP 429 attempt passed on
the existing automatic retry; no assertions or retry configuration were
changed.
Live validation was executed against the final stacked errors plus
scopes/claims sources, not the standalone errors snapshot.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
@spetrescu84
Silviu Petrescu (spetrescu84) merged commit ead0b65 into dev Oct 19, 2026
19 checks passed
Disha Janardhan (djanardhan98) added a commit that referenced this pull request Oct 21, 2026
## Summary

Port Android Native Auth V2 authorize-request inputs and related OTP
parity from AzureAD/microsoft-authentication-library-for-js#8898.

- Accept optional scopes and typed claims for sign-up and password
reset, and propagate inputs for all three V2 entry points.
- Snapshot callback inputs and preserve existing cancellation, callback
delivery, and password clearing.
- Preserve entry scopes when continuation scopes are absent; allow
explicitly empty continuation scopes to select default OIDC scopes.
- Submit empty/short first-factor and MFA OTPs to the service for
validation rather than reject them locally.
- Preserve Native Auth V1 behavior and existing password-to-email
fallback.

**Approved wire policy:** send scopes and optional claims on the initial
authorize-challenge; send scopes but no claims on token exchange.
Intermediate requests send neither. This intentionally follows JS
behavior rather than the work item's literal entry-only scope wording.

Fixes
[AB#3784690](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3784690)

## Dependencies

Stacked on the separate MSAL unified-errors PR:
#2618. Its base is
the errors branch so this diff contains only the scopes/claims
workstream.
Requires the paired Common authorize-inputs PR:
AzureAD/microsoft-authentication-library-common-for-android#3308.
The Common gitlink points to `b41473a29fd7e519108b0630526e652996e38f9f`.
Merge the errors dependencies first, then retarget this PR to `dev`.

## Validation

Scopes/claims snapshot: **661 selected unit tests passed** (218 MSAL,
349 Common4j, 94 Common Android), with zero failures, errors, or skips
in the final XML reports.
Coverage includes all three initial entries, callback input snapshots,
continuation scope retention/override, canonical OIDC defaults on entry
and token requests, empty/short OTP service submission, and standalone
V1 regressions.
Final integrated-stack PR2601 validation: **20 live signup/reset E2E
tests and 4 recorder tests passed**, with 3 known duplicate-account
service-test skips. One Mail.tm `/accounts` HTTP 429 attempt passed on
the existing automatic retry; no assertions or retry configuration were
changed.

The live fixture overlay comes from
#2601 and is not
included in this feature PR.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
Copilot-Session: 55791345-e680-4927-a364-f6de503184be
Copilot-Session: 495388ac-9812-45ec-9120-b110dcbe5903
Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:none No changelog entry or version increment is required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants