Skip to content

feat: add mfa.stepUpWithPopup() for reactive MFA step-up via Universal Login#2524

Merged
tusharpandey13 merged 73 commits intomainfrom
feat/mfa-ul
Apr 22, 2026
Merged

feat: add mfa.stepUpWithPopup() for reactive MFA step-up via Universal Login#2524
tusharpandey13 merged 73 commits intomainfrom
feat/mfa-ul

Conversation

@tusharpandey13
Copy link
Copy Markdown
Contributor

@tusharpandey13 tusharpandey13 commented Feb 16, 2026

Adds client-side mfa.stepUpWithPopup() that completes MFA step-up in a popup window using Auth0 Universal Login, without a full-page redirect.

How it works: When getAccessToken() throws MfaRequiredError, the app calls mfa.stepUpWithPopup({ audience }). A popup opens, the user completes MFA, and the resulting token is cached in the session and returned to the caller.

Changes

  • Added mfa.stepUpWithPopup() to client helpers
  • Added challengeMode?: "redirect" | "popup" to StartInteractiveLoginOptions
  • Added popup mode handling to handleCallback()
  • Updated getTokenSet, handleAccessToken to enable conditional scope merging
  • Added tests for all flows
  • Updated EXAMPLES.md with clear documentation.

Usage

try {
  const token = await getAccessToken({ audience: 'https://api.example.com' });
} catch (err) {
  if (err instanceof MfaRequiredError) {
    // Trigger popup MFA step-up
    const { token } = await mfa.stepUpWithPopup({
      audience: 'https://api.example.com'
    });
  }
}

…n update logic to mfaVerify in auth-client, simplify impl
Resolve conflicts:
- src/server/auth-client.ts: keep both challengeMode and appBaseUrl in OnCallbackContext
- src/server/auth-client.test.ts: add appBaseUrl to all onCallback context expectations
- EXAMPLES.md: keep MFA popup section from feat branch
@gyaneshgouraw-okta
Copy link
Copy Markdown
Contributor

@copilot Review changes in this PR

Comment thread src/client/helpers/get-access-token.ts
Comment thread src/server/auth-client.ts
Comment thread EXAMPLES.md Outdated
@gyaneshgouraw-okta
Copy link
Copy Markdown
Contributor

The PR in general looks well structured. Have added few minor comments.

Comment thread src/server/auth-client.ts Outdated
Comment thread src/client/mfa/index.ts
Comment thread src/server/auth-client.ts Outdated
@nandan-bhat
Copy link
Copy Markdown
Contributor

LGTM

@tusharpandey13 tusharpandey13 merged commit 9d0b615 into main Apr 22, 2026
9 checks passed
@tusharpandey13 tusharpandey13 deleted the feat/mfa-ul branch April 22, 2026 17:43
@tusharpandey13 tusharpandey13 mentioned this pull request Apr 22, 2026
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.

4 participants