Skip to content

Add Native Auth V2 authorize scopes and claims, Fixes AB#3784690 - #2619

Closed
Disha Janardhan (djanardhan98) wants to merge 5 commits into
djanardhan/native-auth-v2-unified-errorsfrom
djanardhan/native-auth-v2-authorize-inputs
Closed

Disha Janardhan (djanardhan98) wants to merge 5 commits into
djanardhan/native-auth-v2-unified-errorsfrom
djanardhan/native-auth-v2-authorize-inputs

Conversation

@djanardhan98

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

Copy link
Copy Markdown
Contributor

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

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.

Fixes AB#3784690

Thread typed entry claims and scopes through public APIs and adapters, snapshot callback inputs, and retain null-versus-empty continuation semantics. Include JS8898 empty/short OTP service-validation parity. Token retains scope and omits claims; V1 is unchanged.

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
(cherry picked from commit 7ac5b2d)
Fixes AB#3784690

Use the Common scope-canonicalization fix validated with MSAL/Common focused suites; retain carried unified-error repair and existing scopes/claims wire policy.

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

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

Copy link
Copy Markdown

❌ Invalid work item number: AB#3784690

##. Work item number must be a valid integer.

Click here to learn more.

@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot changed the title Port Native Auth V2 authorize scopes and claims to Android Port Native Auth V2 authorize scopes and claims to Android, Fixes AB#3784690 Oct 12, 2026
* Not all scopes are guaranteed to be included in the access token returned.
* For V2, null retains entry scopes; an explicit empty list requests only default OIDC scopes.
*/
var scopes: List<String>? = null

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.

These actually need to be removed they can't be sent, if used by v2 same class, we need to make another class for v2 specifically, I am not sure if it even has any parameters.

methodName = "${TAG}.submitCode(code: String)"
)
val state = continuationState ?: return invalidState()
if (code.isEmpty()) {

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.

why was this removed in this PR?

methodName = "${TAG}.submitChallenge(challenge: String)"
)
val state = continuationState ?: return invalidState()
if (challenge.isEmpty()) {

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.

why was this removed in this PR?

@djanardhan98 Disha Janardhan (djanardhan98) changed the title Port Native Auth V2 authorize scopes and claims to Android, Fixes AB#3784690 Add Native Auth V2 authorize scopes and claims, Fixes AB#3784690 Oct 16, 2026
@djanardhan98 Disha Janardhan (djanardhan98) added the changelog:none No changelog entry or version increment is required. label Oct 19, 2026
Resolve the Common submodule conflict with the paired authorize-inputs merge, retaining scopes, claims, and current unified-error diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eafe5634-2142-4235-a7dc-d26bc1baa0d5
Disha Janardhan (djanardhan98) added a commit to AzureAD/microsoft-authentication-library-common-for-android that referenced this pull request Oct 20, 2026
)

## Summary

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

- Build on the existing authorize-challenge scope serialization and add
initial claims propagation.
- Include default OIDC scopes for sign-in, sign-up, and reset;
canonicalize only recognized OIDC defaults while preserving resource
scopes.
- Preserve entry scopes for absent continuation inputs and honor
explicitly empty continuation inputs.
- Exclude claims from token serialization while retaining local
metadata; keep scopes on token requests.
- Allow empty OTP values to reach service validation and preserve
existing password-to-email fallback and V1 behavior.

**Approved wire policy:** scopes and optional claims at initial
authorize-challenge, scopes without claims at token exchange, neither on
other intermediate requests. 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 Common unified-errors PR:
#3307. Its
base is the errors branch so the workstream diff stays isolated.
Consumed by the paired MSAL authorize-inputs PR:
AzureAD/microsoft-authentication-library-for-android#2619.
Merge the errors dependency 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 and token paths, claims wire
encoding, continuation scope retention/override, canonical OIDC defaults
with preserved resource casing/duplicates, empty OTP 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.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Silviu Petrescu <spetrescu@microsoft.com>
Copilot-Session: 0bcd671b-73fa-4ee6-bcd6-65d7eea4d753
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.

2 participants