[Archive] Passwordless no modal SDK won't login users when redirect_uri is provided

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by iurii on 12/5/2024.
This content has been migrated from our previous community forum to preserve valuable discussions.


  • SDK Version(package.json): 8.6.1
  • Platform: Web
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name: Google
    • JWKS Endpoint:
    • Sample idToken (JWT): eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3RvcnVzLXRlc3QuYXV0aDAuY29tLyIsImF1ZCI6ImQ4NGY2eHZiZFY3NVZUR21IaU1XZlpMZVNQazhNMDdDIiwibmFtZSI6Iml1cmlpQG5ldmVybWluZWQuaW8iLCJlbWFpbCI6Iml1cmlpQG5ldmVybWluZWQuaW8iLCJpYXQiOjE3MzMzOTE0OTYsImVhdCI6MTczMzM5MTc5NiwiZXhwIjoxNzMzMzkxNzk2fQ.QE5aoiEbxDvQL3dd5Mj_tBqvisR7zmo9YYu2wYQYRW8m1HzLMzcbEo8p5Xyd-fV1z-gF0l5A8SiNjnWlTi0WiA
web3Auth.instance.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
        loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
        extraLoginOptions: {
          login_hint: emailOrPhone,
          name: 'Email',
          redirect_uri: window.location.href,
        },
      })

When user logs in using passwordless method (email/mobile) on this page with a URL param such as /login?test=param after the redirect from web3auth he gets redirected back to this page /login?test=param#id_token=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3RvcnVzLXRlc3QuYXV0aDAuY29tLyIsImF1ZCI6ImQ4NGY2eHZiZFY3NVZUR21IaU1XZlpMZVNQazhNMDdDIiwibmFtZSI6Iml1cmlpQG5ldmVybWluZWQuaW8iLCJlbWFpbCI6Iml1cmlpQG5ldmVybWluZWQuaW8iLCJpYXQiOjE3MzMzOTE0OTYsImVhdCI6MTczMzM5MTc5NiwiZXhwIjoxNzMzMzkxNzk2fQ.QE5aoiEbxDvQL3dd5Mj_tBqvisR7zmo9YYu2wYQYRW8m1HzLMzcbEo8p5Xyd-fV1z-gF0l5A8SiNjnWlTi0WiA, but web3auth won’t authenticate user and he stays unauthenticated.

If I remove the redirect_uri then the user gets redirected back without any URL parameters although he becomes authenticated, but I need the URL params to be present.

I don’t know where to whitelist the callback URLs since I use Google verifier and there are no such settings or I cannot find them.

What could be the issue with the redirect_uri? There are no errors in the console and I’m not sure how to debug the issue.

Hi Iurii Tankievych,

Thank you for sharing the details about the issue you’re facing with the PnP Web SDK (version 8.6.1) on the Web platform. I understand that you’re experiencing problems with the passwordless login method when a redirect_uri is provided.

Here’s a summary of the information you’ve provided that will help our support team address your issue:

  • SDK Details: PnP Web SDK
  • SDK Version: 8.6.1
  • Platform: Web
  • Login Provider: Email Passwordless
  • Redirect URI: window.location.href
  • Verifier Name: nvm-testnet-google-verifier
  • Sample idToken (JWT): Provided in your message

Code Snippet

web3Auth.instance.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
  loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
  extraLoginOptions: {
    login_hint: emailOrPhone,
    name: 'Email',
    redirect_uri: window.location.href,
  },
})

Issue Description

Users are redirected back to /login?test=param#id_token=... after using the passwordless method with the redirect_uri, but they remain unauthenticated. When the redirect_uri is removed, users get redirected back without any URL parameters but successfully authenticate.

Proposed Solution

Please check if the redirect_uri that you are providing is whitelisted in your Web3Auth configuration. Sometimes, the platform requires that any redirect URIs used must be explicitly configured to prevent unauthorized redirection.

If you’re still facing issues, consider trying different URLs or checking if any other potential configurations in your Web3Auth setup might be affecting the behavior.

If the problem persists, it would be helpful to gather any additional information from your browser console or try to debug using network activity when the redirection occurs.

I hope this helps you in diagnosing the issue further! If you have any more information or need additional assistance, feel free to share. Your input is valuable, and we’re here to support you!

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

The proposed solution doesn’t help because I have nowhere to configure the redirect URIs, as I mentioned we use Google Verifier and there are no such settings, where else can I configure them?

We are still having this issue. Any update?

Hey @iurii

If you specify the redirect url in the auth adapter params, it will preserve the url params. Please remove the redirect_uri from your extraLoginOptions.

Try something similar to this:

const authadapter = new AuthAdapter({
  adapterSettings: {
    replaceUrlOnRedirect: true,
    uxMode: "redirect",
    redirectUrl: "http://localhost:5173/?abcdeh=askjhd",
  }
});