Redirect_uri setting ignored after authentication

Creating a new fresh thread for an old GitHub issue: Redirect URL setting after authentication is ignored - [Legacy] GitHub Discussions - Web3Auth Community as I was advised by @maharshi

I am experiencing the exact same issue.

With this code if I am at page X (eg. https://www.me.com/authenticate) and do redirect_uri:Y (eg. https://www.me.com/welcome) then after visiting to web3auth page for token verification it redirects back to X and not Y

//while at page X

const extraLoginOptions = {
   id_token: jwt,
   verifierIdField: "sub",
   redirect_uri = Y //another page
};
await web3auth.connectTo(WALLET_ADAPTERS.AUTH, {
   loginProvider: "jwt",
   extraLoginOptions: extraLoginOptions,
});

//browser goes to web3auth for jwt verification but returns back to **X** and not Y

–edit–

I am using latest non-alpha libraries web3auth/no-modal 9.1.0 web3auth/ethereum-provider 9.0.2 etc. There are no errors in the console.

Thanks for providing the details, Silver Sepp!

It seems like you’re facing an issue with the redirect_uri setting being ignored after authentication using the Web3Auth PnP Web SDK. You’ve provided a clear code snippet, which is very helpful.

A few additional details would be helpful to better understand and diagnose the issue:

  1. SDK Version Number: Which version of the PnP Web SDK are you using?
  2. Browser Console Screenshots: If possible, please provide any console errors or logs from your browser. This might include messages that could help in debugging the redirect issue.

While you gather this information, a couple of things you might want to quickly double-check:

  • Ensure the redirect_uri is properly formatted and is a valid URL.
  • Sometimes cache or cookies can cause unexpected behaviors; you might want to clear these and retry.

This response was generated by the Web3Auth Bot, and a member of the Web3Auth team will also review your query and get back to you soon.

Does this work for others?

Hey @silver,

The redirectUrl in ExtraLoginOptions is essentially provided to Auth0. It’s the URL where Auth0 redirects your browser with the authentication result. This URL needs to be whitelisted in the “Allowed Callback URLs” field within your Auth0 application’s settings.

Do you currently have an Auth0 login setup, or are you using a different authentication provider?

Also, try passing the redirectUrl parameter directly into the AuthAdapter settings, as demonstrated in the AuthAdapter documentation. This might help resolve the issue you’re facing.

Ah ok got it, is there any way to also redirect if not using Auth0? I mean redirect back from Web3Auth page that does token verification.

Hey @silver
there is a way, as said in the previous reply you pass the redirectUrl parameter to adapterSettings object while initializing AuthAdapter.

const authAdapter = new AuthAdapter({
          adapterSettings: {
            redirectUrl: "",
            uxMode: "redirect",
......

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.