Client network mismatch

I am using web3auth modal for a webapp to interface with Ethereum and Arbitrum. Currently the web3 login methods like metmask work fine, but all web2 methods (e.g. email, google) give the following error:

Invalid params, {“code”:1002,“error”:“Client network mismatch, clientId belongs to network: sapphire_mainnet, and app is configured on network: mainnet”,“success”:false}

Screenshot 2024-10-27 at 15.48.32

I am using the following chainConfig for ethereum:

{
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: “0x1”, // Ethereum Mainnet
rpcTarget: https://mainnet.infura.io/v3/${infura_api_key}, // Mainnet RPC
displayName: “Ethereum Mainnet”, // Corrected from Sepolia to Mainnet
blockExplorerUrl: “https://etherscan.io”, // Correct URL for Mainnet
ticker: “ETH”,
tickerName: “Ethereum”,
logo: “https://cryptologos.cc/logos/ethereum-eth-logo.png”,
}

The project is configured for sapphire_mainnet. I do not see any option for ethereum mainnet when creating a project. I think this is because of the migration from ethereum to sapphire, but i am unsure.

Using the following package versions:

"@web3auth/base": "^9.0.2",
"@web3auth/coinbase-adapter": "^9.0.2",
"@web3auth/ethereum-provider": "^9.0.2",
"@web3auth/metamask-adapter": "^8.12.4",
"@web3auth/modal": "^9.1.0",
"@web3auth/wallet-connect-v2-adapter": "^9.1.0",

Does web3auth still support web2 logins to ethereum after the sapphire migration? If so, what can I do to fix this error? Thanks.

Hi there! It looks like you’re encountering an issue related to network configuration with Web3Auth. Here’s a summary of the details you provided that will help our support team in addressing your issue:

SDK Details:

  • SDK: PnP Web SDK

Issue:

  • Error: Client network mismatch
  • Error Message: Invalid params, {“code”:1002,“error”:“Client network mismatch, clientId belongs to network: sapphire_mainnet, and app is configured on network: mainnet”,“success”:false}

Chain Configuration:

{
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: "0x1", // Ethereum Mainnet
    rpcTarget: `https://mainnet.infura.io/v3/${infura_api_key}`, 
    displayName: "Ethereum Mainnet",
    blockExplorerUrl: "https://etherscan.io",
    ticker: "ETH",
    tickerName: "Ethereum",
    logo: "https://cryptologos.cc/logos/ethereum-eth-logo.png",
}

Package Versions:

  • @web3auth/base”: “^9.0.2”
  • @web3auth/coinbase-adapter”: “^9.0.2”
  • @web3auth/ethereum-provider”: “^9.0.2”
  • @web3auth/metamask-adapter”: “^8.12.4”
  • @web3auth/modal”: “^9.1.0”
  • @web3auth/wallet-connect-v2-adapter”: “^9.1.0”

Screenshot Provided: Yes (Issue Screenshot)

Proposed Solution:

It appears that the mismatch is occurring due to the network configuration in your project setup. Since your project is configured for sapphire_mainnet, ensure that the Web2 login methods are also set up to connect through the same network. If you want to switch to Ethereum Mainnet, you might need to update your project settings or check for any selection options for Ethereum in your Web3Auth configuration.

Regarding your question, Web3Auth should still support Web2 logins to Ethereum, but it’s crucial to ensure that the configurations align with the correct network settings post-migration.

If you’ve checked these and are still facing issues, consider reaching out to the support team with your project settings for more tailored advice.

Feel free to reach out if you need further assistance! :blush:

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.

Yes, the project is configured for sapphire mainnet. There is no option for ethereum mainnet from what I can tell.

Hey @whiterock

Please change the web3auth network from mainnet to sapphire_mainnet.

const web3auth = new Web3AuthModal({
  clientId: "",
  web3AuthNetwork: `sapphire_mainnet`, // <<<<---  from `mainnet`
  privateKeyProvider,
});

Hi @shahbaz
Thanks for the response.

But if we change to “sapphire_mainnet”, will the transactions happen on ethereum mainnet? It is important that our app works on ethereum mainnet.

Here, the sapphire_mainnet is a Web3Auth network and is not related to the Ethereum mainnet or any blockchain. To use the chain, please configure it in chainConfig.

const chainConfig = {
  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://images.toruswallet.io/eth.svg",
};

Hi,
We do not want to use sapphire. We want to use ethereum and arbitrum. How can we do this?

sapphire_mainnet is a Web3Auth network that is not related to blockchain networks. You can continue to use Ethereum and Arbitrum.

Ok I understand. Web2 login works now. Thank you for your help shahbaz.

1 Like

Welcome @whiterock

Happy to help.

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