# \[Archive\] Web3 auth login fails after redirect from local to ttps://auth.web3auth.io/v9/callback (Twitter login)

**URL:** <https://builder.metamask.io/t/archive-web3-auth-login-fails-after-redirect-from-local-to-ttps-auth-web3auth-io-v9-callback-twitter-login/1108>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [January 26, 2025, 5:35pm UTC](https://builder.metamask.io/t/archive-web3-auth-login-fails-after-redirect-from-local-to-ttps-auth-web3auth-io-v9-callback-twitter-login/1108 "2025-01-26T17:35:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srocalag](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@srocalag](https://builder.metamask.io/u/srocalag)\
**Post date:** [January 26, 2025, 5:35pm UTC](https://builder.metamask.io/t/archive-web3-auth-login-fails-after-redirect-from-local-to-ttps-auth-web3auth-io-v9-callback-twitter-login/1108/1 "2025-01-26T17:35:35Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **srocalag** on 1/26/2025.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

First step of Sign in does show a pop up that later shows a pop-up that redirects the user to a web3 auth url. However, after that a jwt-related error is shown in the pop-up screen and web3Auth login fails. How can this issue be fixed?

[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/a189b637471ade2a0a6a3d83438ffb60354b20ec.png)
image2688×810 134 KB
](https://web3auth.io/community/uploads/default/original/2X/1/1e68684fd8059363db13f98e92d9ede4542f7e10.png "image")

Some extra info to make it easier to dig into the issue:

- **SDK Version** (package.json):

```auto
    "@web3auth/auth-adapter": "^9.5.2",
    "@web3auth/base": "^9.5.2",
    "@web3auth/ethereum-provider": "^9.5.2",
    "@web3auth/no-modal": "^9.5.2",

```

- **Platform** :  
Web Application (Next.js)

- **Browser Console Screenshots** :  

```auto
"jwtParams": {
            "domain": "http://localhost:3001",
            "connection": "twitter",
            "isVerifierIdCaseSensitive": false,
            "verifierIdField": "sub"
          },

```

- Sample idToken (JWT):  
`"eyJhbGciOiJSUzI1NiIsImtpZCI6IjBhYmQzYTQzMTc4YzE0MjlkNWE0NDBiYWUzNzM1NDRjMDlmNGUzODciLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiU1JMIiwicGljdHVyZSI6Imh0dHBzOi8vcGJzLnR3aW1nLmNvbS9wcm9maWxlX2ltYWdlcy8xNzc4ODY4Nzk3NzQwMzAyMzM2L3lKTlg3cGJJX25vcm1hbC5qcGciLCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZmFpcnN3YXAtMjQwMTgiLCJhdWQiOiJmYWlyc3dhcC0yNDAxOCIsImF1dGhfdGltZSI6MTczNzMwNjA4MiwidXNlcl9pZCI6IlFjUldwSTd6enFjOWdxVGptOFU1a0h4REpRQjMiLCJzdWIiOiJRY1JXcEk3enpxYzlncVRqbThVNWtIeERKUUIzIiwiaWF0IjoxNzM3MzA2MDgyLCJleHAiOjE3MzczMDk2ODIsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsidHdpdHRlci5jb20iOlsiMTQ5ODc1NDYyMDk4NTkwNTE1NCJdfSwic2lnbl9pbl9wcm92aWRlciI6InR3aXR0ZXIuY29tIn19.Em1bjf11cKhI1iFGDIwqatCq32yiidEmYfCXCxR8PvUm_Td2rpY0Hk-Sy_J7DbJtwUV1OuhYOA_7zxiY36mY5Bh4AugrPu4ry877dsrG_YNa2Qg2FeLKR_L64-OBvTevVRBHOnata0-QRBeLxGz31yZ7vof38ndqVqXxorHn0Hnr__nK4dBdkdHAQwTESnkLRjHDYLjMIIFMusOz1wVaJRXraW0AFOUcyr_nRrgty4J7kTqwvbKTaNdalNBXUPg6hg-y2nvHGDBwU37Gx1v2pgAtrC55C4duM8uDTkFw2spGdKhEjArVmlZ_GgtIjy7ohJdIYArvnII5ryz-GTlyrw"`

**Web3Auth initialization and login code snippet**

Login code snippet:

```auto
 function signInWithTwitter() {
    signInWithPopup(auth, provider)
      .then(async (result) => {
        // User signed in successfully
        const user = result.user;
        const userToken = await user.getIdToken(true);
        console.log("idToken", userToken);
    localStorage.setItem("user", JSON.stringify(user));

    const chainConfig = {
      chainNamespace: CHAIN_NAMESPACES.EIP155,
      chainId: "0x1", // Please use 0x1 for Mainnet
      rpcTarget: "https://rpc.ankr.com/eth",
      displayName: "Ethereum Mainnet",
      blockExplorerUrl: "https://etherscan.io/",
      ticker: "ETH",
      tickerName: "Ethereum",
      logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
    };

    const privateKeyProvider = new EthereumPrivateKeyProvider({
      config: { chainConfig },
    });

    const web3auth = new Web3AuthNoModal({
      clientId: CLIENT_ID,
      chainConfig, // Ensure chainConfig is passed here

      web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
      privateKeyProvider,
    });

    // Add wallet adapter for auth wallet
    console.log("wallet adapter", WALLET_ADAPTERS.AUTH);
    const authAdapter = new AuthAdapter({
      privateKeyProvider,
      adapterSettings: {
        uxMode: UX_MODE.POPUP,
        loginConfig: {
          jwt: {
            verifier: "w3a-fairswap",
            typeOfLogin: "twitter",
            clientId: CLIENT_ID,
          },
        },
      },
    });
    web3auth.configureAdapter(authAdapter);

    await web3auth.init();

    // Save user data to Firestore
    await web3auth.connectTo(WALLET_ADAPTERS.AUTH, {
      loginProvider: "twitter",
      extraLoginOptions: {
        id_token: userToken,
        verifierIdField: "sub",
        domain: "http://localhost:3001",
      },
    });
  })
  .catch((error) =&gt; {
    // Handle Errors here.
    console.log("Error signing in: " + error.message);
  });

}

```

Is any config wrong or any step missing?

---

<div class="post-metadata">

**Author:** ![w3abot](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@w3abot](https://builder.metamask.io/u/w3abot)\
**Post date:** [January 26, 2025, 5:36pm UTC](https://builder.metamask.io/t/archive-web3-auth-login-fails-after-redirect-from-local-to-ttps-auth-web3auth-io-v9-callback-twitter-login/1108/2 "2025-01-26T17:36:54Z")

</div>

Hello there! Thanks for sharing all the details. It seems like you’re encountering a JWT-related error during the Web3Auth login flow with Twitter. Let’s see if we can spot any issues in the configuration:

1. **Verifier Name** : Ensure that the `web3auth` verifier is correctly set up in the project’s settings in the Web3Auth dashboard.

2. **JWT Configuration** : The JWT parameters in the code snippet need to precisely match the settings used in Web3Auth dashboard. Double-check that the `domain`, `verifierIdField`, and other JWT parameters are accurately configured.

3. **Auth Initialization** : Confirm that the `CLIENT_ID` and other dynamic values in your setup are correctly set, as incorrect configuration might lead to token validation issues.

4. **Provider Settings** : Check that the `loginConfig` for the `AuthAdapter` is correct, especially the `verifier` and `typeOfLogin` values.

5. **Testing Environment** : Ensure that your local setup (e.g., domain and port) matches the JWT `domain` parameter.

Everything else seems to be correctly aligned regarding the basic initialization and login steps. If these suggestions don’t help resolve the issue, I recommend reaching out with this detailed information to your Web3Auth support for more personalized assistance.

Additionally, if you’ve recently updated any SDK versions or changed configuration settings, reverting back to a previous working setup might help identify the problem.

Feel free to ask if you have more questions or need further clarifications! 😊

> 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.

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [February 3, 2025, 11:13am UTC](https://builder.metamask.io/t/archive-web3-auth-login-fails-after-redirect-from-local-to-ttps-auth-web3auth-io-v9-callback-twitter-login/1108/3 "2025-02-03T11:13:29Z")

</div>

> [@srocalag](#):
>
> [![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/04ac859e84e3973301f64d60a041883016cceb2c.png)
> image2688×810 262 KB
> ](https://web3auth.io/community/uploads/default/original/2X/8/8b80db2fce737afd2e8ad4c6765d2efe72a3ea47.png "image")

Hey @srocalag

From the console logs, looks like you’re using web3auth twitter verifier and some wrong config.

Kindly share the init and login code to better assist you.
