Redirect URL not working properly in Web3Auth v10 (Modal) after OTP login

We recently upgraded our integration to Web3Auth v10 (Modal) and are facing an issue with the redirect flow after OTP/email login.

Previously, in older versions, we used:

const web3Auth = new Web3AuthNoModal({
  chainConfig,
  clientId: CLIENT_ID,
  web3AuthNetwork: "mainnet",
  privateKeyProvider,
});

web3Auth.configureAdapter(
  new AuthAdapter({
    privateKeyProvider,
    adapterSettings: {
      uxMode: UX_MODE.REDIRECT,
      redirectUrl:window.location.origin       
    },
    loginSettings: {
      mfaLevel: "none",
    },
  })
);

Everything worked fine before — the user was redirected back to the same URL after a successful login.

Now, after updating to v10, the OTP modal opens in the same tab (which is good), but the redirect flow breaks — it doesn’t properly return to the redirect URL after login from where we initiate the Web3Auth connection.

We also tried explicitly setting redirectUrl in both the Web3AuthOptions and in the connectTo() method, but it still doesn’t redirect correctly.

Updated version (v10):

const web3auth = new Web3Auth({
  clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID,
  web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
  uiConfig: {
    uxMode: "redirect",
  },
});

We also tried passing the redirect URL dynamically during login:

await web3auth.login({
  loginProvider: "email_passwordless",
  extraLoginOptions: { login_hint: email },
  redirectUrl: window.location.origin,
});

But the redirect still doesn’t happen correctly — the URL we use to log in with Web3Auth doesn’t redirect back to the same URL after the OTP step.


Package details:

"@web3auth/auth": "^10.6.0",
"@web3auth/base": "^9.7.0",
"@web3auth/base-provider": "^9.7.0",
"@web3auth/modal": "^10.6.0",
"@web3auth/no-modal": "^10.6.0"


We’d really appreciate guidance on how to properly handle redirectUrl in v10 — does it need to be configured differently now or explicitly set in the dashboard?

Hi Umair — thanks for the clear write-up, this is very helpful. I understand you upgraded to Web3Auth v10 (modal) and the OTP/email login opens in the same tab but does not redirect back to the originating URL after the OTP step. I’ll summarize what I’m seeing and list quick checks and the minimal items our support team will need to investigate.

Summary of extracted details

  • SDK / integration: Web3Auth (modal) v10
  • Packages & versions you provided: @web3auth/auth ^10.6.0, @web3auth/modal ^10.6.0, @web3auth/no-modal ^10.6.0 (plus base packages 9.7.0)
  • Platform: Web (browser / Next.js — you reference window.location)
  • Config you tried (examples included): uiConfig: { uxMode: “redirect” }, passing redirectUrl via login() and via adapterSettings in older no-modal code
  • Symptom: after OTP flow the final redirect does not return to the redirectUrl you provided (works in older version)

Quick checks / likely causes to confirm (most common):

  1. Redirect URL must be registered in Web3Auth dashboard
    • Web3Auth requires the exact redirect URI to be allowed/whitelisted in your app settings. Make sure the exact absolute URL (including path if used, e.g. https://example.com/b) is registered.
  2. Ensure the redirect URL exactly matches (protocol + host + path). No trailing slash mismatch, exact path match, same origin.
  3. UX mode consistency
    • You set uiConfig: { uxMode: “redirect” } — that is correct for a redirect flow. Make sure there is not another place overriding it.
  4. Where to pass redirect URL
    • Passing a redirectUrl in the login/connect call is fine, but it must match the dashboard-registered URL. If you set a redirect URL dynamically (window.location.pathname logic) ensure that every possible value is also added to dashboard or that you only use one canonical redirect URL.
  5. Flow differences between modal and no-modal
    • The modal/hosted flow may behave slightly differently than the older no-modal adapter. If you previously relied on the adapterSettings.redirectUrl behavior, double-check v10 modal usage for where redirect must be set (dashboard + login/connect options).

What we need from you (minimal, to avoid extra back-and-forth)

  • Confirm the exact redirect URL you expect (example: https://yourdomain.com or https://yourdomain.com/b) and confirm whether that exact URL is registered in the Web3Auth dashboard.
  • The full initialization & login snippet you’re using in v10 (you posted parts — please paste the exact code you call at startup and the exact login/connect call you make).
  • A browser console screenshot or network log from a failed flow (especially any messages about missing/invalid redirect_uri or cross-origin failures). If you can capture the final redirected URL (or lack of it) that’s helpful.

Short troubleshooting steps you can try right now

  • Register the exact redirect URL in the Web3Auth dashboard (if you haven’t already) and test with that single URL (avoid dynamic per-path redirects initially).
  • Use an absolute redirect URL string when calling login/connect (e.g. redirectUrl: window.location.origin + “/b”) and make sure this exact URL is in the dashboard.
  • Try a minimal repro page (simple HTML/JS) with uxMode: “redirect” and the redirectUrl set to a known whitelisted URL — this isolates Next.js routing concerns.

If you’d like, paste the exact v10 init + login/connect calls here and confirm whether the redirect URL is whitelisted in the Web3Auth dashboard. Once you provide that (and a console/network capture if available) I’ll pass it to the support team in a concise ticket so they can diagnose further.

Note: This response was generated by an AI bot and may require further verification. The MetaMask Community Team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. MetaMask Developer Office Hours

Hey there,

Thanks a lot for your question. The issue here is related to an undocumented feature for specifying your redirectUrl. Passing the redirectUrl in the login function won’t work, it has to be specified in your web3auth context itself.
Following your code, here is a snippet that can work:

import { UX_MODE, WEB3AUTH_NETWORK, authConnector } from “@web3auth/modal”;

const web3auth = new Web3Auth({
  clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID,
  web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
  uiConfig: {
    uxMode: “redirect”,
  },
  connectors: [
    authConnector({
      connectorSettings: {
        redirectUrl: window.location.origin,
      }
    })
  ]
});

in case you you have upgraded to use Web3auth Modal v10
Then may I ask why are you using the WebAuthNoModal constructor?
no-modal is now an internal SDK and @web3auth/modal on v10 has all the features that both @web3auth/no-modal and @web3auth/modal used to have
Also, don’t you get an error that web3auth.login() is not a method?
I haven’t seen this method before