Skip to content

Add downgradeFromDPoP for in-place DPoP→Bearer migration - #3004

Merged
sfdctaka merged 2 commits into
forcedotcom:devfrom
sfdctaka:feature/dpop-downgrade-api
Aug 25, 2026
Merged

Add downgradeFromDPoP for in-place DPoP→Bearer migration#3004
sfdctaka merged 2 commits into
forcedotcom:devfrom
sfdctaka:feature/dpop-downgrade-api

Conversation

@sfdctaka

Copy link
Copy Markdown
Contributor

What

Adds UserAccountManager.downgradeFromDPoP(userAccount, onSuccess, onFailure), the inverse of the existing upgradeToDPoP. It rolls a DPoP-bound session back to unbound Bearer in place — same connected app, redirect URI, and scopes — independent of the global useDPoP flag. It is a no-op (invokes onSuccess with the unchanged account) when the session is already Bearer.

Why

Completes the in-place DPoP migration pair so apps can move a user off DPoP without a full logout/login, mirroring upgradeToDPoP.

Changes

  • UserAccountManagerExtension — new downgradeFromDPoP extension delegating to migrateRefreshToken with useDPoP = false; no-op guard when already Bearer. On success it deletes the obsolete DPoP key pair + nonce-cache entries keyed to the pre-downgrade credentials. Also adds a matching no-op guard to the existing upgradeToDPoP (returns the unchanged account when already DPoP-bound).
  • AuthFlowTester — "Downgrade from DPoP" action (enabled only for a DPoP-bound session), downgrade UI test, and a downgrade validation helper. Removes an obsolete DPoP test-server entry.
  • Custom Tab login test fix — a Salesforce My Domain page renders username + password on one screen; the previous unconditional "advance" tap submitted an empty password and the position-based lookup then typed the password into the username field. The helper now advances only on a genuine two-step page, targets the password field explicitly, and dismisses the soft keyboard before submitting.

Review notes

  • Touches a public API and the credential/login-UI surface — requesting maintainer (Wolf) review before merge; kept as draft.
  • New user-facing strings are in AuthFlowTester's own strings.xml (sample-app labels for the downgrade button), not the SDK's sf__strings.xml.

Add UserAccountManager.downgradeFromDPoP(userAccount, onSuccess, onFailure),
the inverse of upgradeToDPoP: it rolls a DPoP-bound session back to unbound
Bearer in place using the same connected app, redirect URI, and scopes,
independent of the global DPoP setting. It is a no-op (invokes onSuccess with
the unchanged account) when the session is already Bearer.

AuthFlowTester: add a "Downgrade from DPoP" action (enabled only for a
DPoP-bound session), a downgrade UI test, and a downgrade validation helper.
Remove an obsolete DPoP test-server entry.

Also fix combined-page Custom Tab login in the UI tests: a Salesforce My
Domain page renders username and password on one screen, so the previous
unconditional "advance" tap submitted an empty password and the position-based
field lookup then typed the password into the username field. Now the helper
advances only on a genuine two-step page, targets the password field
explicitly, and dismisses the soft keyboard before submitting so the Log In
button is not covered.
@sfdctaka
sfdctaka marked this pull request as ready for review August 24, 2026 21:48
…gger

Address review on downgradeFromDPoP:
- Remove the dead `wasDPoPBound` flag and its guard. The function returns early
  when the account is not DPoP-bound, so by the time the success-callback runs
  the account is always DPoP-bound and the guard was always true.
- Drop the bare `SalesforceSDKLogger.w` import and call it class-qualified,
  matching the `SalesforceSDKLogger.e/.i` style used throughout the file.
@sfdctaka
sfdctaka merged commit a3cf395 into forcedotcom:dev Aug 25, 2026
4 of 6 checks passed
@sfdctaka
sfdctaka deleted the feature/dpop-downgrade-api branch August 25, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants