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?
Some extra info to make it easier to dig into the issue:
- SDK Version(package.json):
"@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:
- Verifier Name:
web3auth - JWKS Endpoint:
- Verifier Name:
"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:
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) => { // Handle Errors here. console.log("Error signing in: " + error.message); });}
Is any config wrong or any step missing?

