Skip to content

Comments

feat: add mfa events to oauth flows#1035

Open
sherzod-bakhodirov wants to merge 10 commits intomasterfrom
sherzodbakhodirov/emb-211-implement-headless-mfa-flow-for-oauth-magic-widget
Open

feat: add mfa events to oauth flows#1035
sherzod-bakhodirov wants to merge 10 commits intomasterfrom
sherzodbakhodirov/emb-211-implement-headless-mfa-flow-for-oauth-magic-widget

Conversation

@sherzod-bakhodirov
Copy link
Contributor

@sherzod-bakhodirov sherzod-bakhodirov commented Feb 16, 2026

📦 Pull Request

[Provide a general summary of the pull request here.]

✅ Fixed Issues

  • [List any fixed issues here like: Fixes #XXXX]

🚨 Test instructions

[Describe any additional context required to test the PR/feature/bug fix.]

⚠️ Don't forget to add a semver label!

Please 🚨 ONLY ADD ONE 🚨 of the following labels, failing to do so may lead to adverse versioning of your changes when published:

  • patch: Bug Fix?
  • minor: New Feature?
  • major: Breaking Change?
  • skip-release: It's unnecessary to publish this change.

Special Note

Please avoid adding any of the Priority labels as they conflict with the labels above ☝️

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @magic-ext/algorand@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/aptos@16.3.2-canary.1035.22221112203.0
npm install @magic-ext/avalanche@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/bitcoin@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/conflux@26.3.2-canary.1035.22221112203.0
npm install @magic-ext/cosmos@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/ed25519@24.3.2-canary.1035.22221112203.0
npm install @magic-ext/evm@1.2.2-canary.1035.22221112203.0
npm install @magic-ext/farcaster@5.3.2-canary.1035.22221112203.0
npm install @magic-ext/flow@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/gdkms@16.3.2-canary.1035.22221112203.0
npm install @magic-ext/harmony@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/hedera@2.2.2-canary.1035.22221112203.0
npm install @magic-ext/icon@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/kadena@5.3.2-canary.1035.22221112203.0
npm install @magic-ext/near@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/oauth2@15.3.2-canary.1035.22221112203.0
npm install @magic-ext/oidc@16.3.2-canary.1035.22221112203.0
npm install @magic-ext/polkadot@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/react-native-bare-oauth@30.3.2-canary.1035.22221112203.0
npm install @magic-ext/react-native-expo-oauth@30.3.2-canary.1035.22221112203.0
npm install @magic-ext/siwe@3.3.2-canary.1035.22221112203.0
npm install @magic-ext/solana@30.3.2-canary.1035.22221112203.0
npm install @magic-ext/sui@5.3.2-canary.1035.22221112203.0
npm install @magic-ext/taquito@25.3.2-canary.1035.22221112203.0
npm install @magic-ext/terra@25.3.2-canary.1035.22221112203.0
npm install @magic-ext/tezos@28.3.2-canary.1035.22221112203.0
npm install @magic-ext/wallet-kit@0.5.1-canary.1035.22221112203.0
npm install @magic-ext/webauthn@27.3.2-canary.1035.22221112203.0
npm install @magic-ext/zilliqa@28.3.2-canary.1035.22221112203.0
npm install @magic-sdk/provider@33.4.2-canary.1035.22221112203.0
npm install @magic-sdk/react-native-bare@34.2.2-canary.1035.22221112203.0
npm install @magic-sdk/react-native-expo@34.2.2-canary.1035.22221112203.0
npm install @magic-sdk/types@27.4.1-canary.1035.22221112203.0
npm install magic-sdk@33.4.2-canary.1035.22221112203.0
# or 
yarn add @magic-ext/algorand@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/aptos@16.3.2-canary.1035.22221112203.0
yarn add @magic-ext/avalanche@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/bitcoin@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/conflux@26.3.2-canary.1035.22221112203.0
yarn add @magic-ext/cosmos@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/ed25519@24.3.2-canary.1035.22221112203.0
yarn add @magic-ext/evm@1.2.2-canary.1035.22221112203.0
yarn add @magic-ext/farcaster@5.3.2-canary.1035.22221112203.0
yarn add @magic-ext/flow@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/gdkms@16.3.2-canary.1035.22221112203.0
yarn add @magic-ext/harmony@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/hedera@2.2.2-canary.1035.22221112203.0
yarn add @magic-ext/icon@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/kadena@5.3.2-canary.1035.22221112203.0
yarn add @magic-ext/near@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/oauth2@15.3.2-canary.1035.22221112203.0
yarn add @magic-ext/oidc@16.3.2-canary.1035.22221112203.0
yarn add @magic-ext/polkadot@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/react-native-bare-oauth@30.3.2-canary.1035.22221112203.0
yarn add @magic-ext/react-native-expo-oauth@30.3.2-canary.1035.22221112203.0
yarn add @magic-ext/siwe@3.3.2-canary.1035.22221112203.0
yarn add @magic-ext/solana@30.3.2-canary.1035.22221112203.0
yarn add @magic-ext/sui@5.3.2-canary.1035.22221112203.0
yarn add @magic-ext/taquito@25.3.2-canary.1035.22221112203.0
yarn add @magic-ext/terra@25.3.2-canary.1035.22221112203.0
yarn add @magic-ext/tezos@28.3.2-canary.1035.22221112203.0
yarn add @magic-ext/wallet-kit@0.5.1-canary.1035.22221112203.0
yarn add @magic-ext/webauthn@27.3.2-canary.1035.22221112203.0
yarn add @magic-ext/zilliqa@28.3.2-canary.1035.22221112203.0
yarn add @magic-sdk/provider@33.4.2-canary.1035.22221112203.0
yarn add @magic-sdk/react-native-bare@34.2.2-canary.1035.22221112203.0
yarn add @magic-sdk/react-native-expo@34.2.2-canary.1035.22221112203.0
yarn add @magic-sdk/types@27.4.1-canary.1035.22221112203.0
yarn add magic-sdk@33.4.2-canary.1035.22221112203.0

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds MFA-related event support to OAuth popup and redirect flows by introducing shared OAuth MFA event types, wiring those events through the oauth2 extension and wallet-kit extension, and updating wallet-kit UI/state management to drive MFA and recovery-code screens during OAuth login.

Changes:

  • Introduce shared OAuth MFA event enums/handler typings and include them in intermediary event unions.
  • Add showUI option and MFA event wiring to @magic-ext/oauth2 popup + redirect result flows.
  • Refactor wallet-kit OAuth login to use a new OAuthLoginContext + useMfa hook and update the wallet-kit extension OAuth popup flow to emit MFA events.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
yarn.lock Bumps workspace dependency ranges (notably @magic-sdk/provider / RN packages).
packages/@magic-sdk/types/src/modules/oauth-types.ts Adds shared OAuth MFA event enums and composes them into popup/redirect handler types.
packages/@magic-sdk/types/src/modules/intermediary-types.ts Extends IntermediaryEvents to include new OAuth MFA event strings.
packages/@magic-ext/wallet-kit/src/views/RecoveryCode.tsx Switches recovery-code submission to the new useMfa() routing hook.
packages/@magic-ext/wallet-kit/src/views/OAuthPendingView.tsx Moves OAuth login initiation to OAuthLoginContext and simplifies pending UI state.
packages/@magic-ext/wallet-kit/src/views/MfaView.tsx Switches MFA actions to the new useMfa() routing hook.
packages/@magic-ext/wallet-kit/src/hooks/useOAuthLogin.ts Removes the old standalone OAuth login hook in favor of context-based flow.
packages/@magic-ext/wallet-kit/src/hooks/useMfa.ts Adds a routing hook that selects OAuth vs email MFA handlers based on active flow.
packages/@magic-ext/wallet-kit/src/extension.ts Updates loginWithPopup to return a PromiEvent and forward MFA intermediary events.
packages/@magic-ext/wallet-kit/src/context/index.ts Exports the new OAuthLoginProvider / useOAuthLogin.
packages/@magic-ext/wallet-kit/src/context/OAuthLoginContext.tsx Adds context to manage OAuth login PromiEvent lifecycle and MFA event dispatching.
packages/@magic-ext/wallet-kit/src/MagicWidget.tsx Wraps widget with OAuthLoginProvider to enable OAuth MFA flows.
packages/@magic-ext/oauth2/src/types.ts Adds showUI?: boolean to popup + verification configurations.
packages/@magic-ext/oauth2/src/index.ts Wires MFA events into OAuth popup + redirect result flows and refactors redirect-result parsing into a method.
Comments suppressed due to low confidence (1)

packages/@magic-ext/oauth2/src/index.ts:105

  • showUI is optional, but the checks use if (!showUI) which treats undefined the same as false. That changes the default behavior for existing callers that don’t pass showUI (they’ll now get the no-UI/MFA event wiring path). Consider defaulting showUI to true via destructuring (const { showUI = true } = ...) or gating on showUI === false.
  public loginWithPopup(configuration: OAuthPopupConfiguration) {
    const { showUI } = configuration;
    const requestPayload = this.utils.createJsonRpcRequestPayload(OAuthPayloadMethods.Popup, [
      {
        ...configuration,
        returnTo: window.location.href,
        apiKey: this.sdk.apiKey,
        platform: 'web',
      },
    ]);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sherzod-bakhodirov and others added 4 commits February 19, 2026 07:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sherzod-bakhodirov sherzod-bakhodirov marked this pull request as ready for review February 19, 2026 02:36
@sherzod-bakhodirov sherzod-bakhodirov requested a review from a team as a code owner February 19, 2026 02:36
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.

1 participant