Web3auth error with chain id

Please when I add chain id to web3auth configuration, it stops working but when I remove it, it works well during authentication but fires errors during contract interaction and I think thatā€™s because I removed chain id.

Please how do I handle this, I am on avalanche fuji test net

How are you adding chaid id into the authentication? Also are you sure you are on the right chain in your metamask when interacting with your contract and what is the error that you get

I am integrating Web3Auth and not metamask, According to moralis doc, chainId is optional but the default value is etheruem id

What chain id are you passing in?

43113 and 0xa869
non worked and they are both correct

Thatā€™s weird. Maybe try ā€œavalanche testnetā€; probably a long shot but worth a try

you mean enter avalanche test net as chain id?

Yep, itā€™s the only flag left that could work, so I figured itā€™s worth a shot

export const webAuthConnect = async (authenticate, dispatch) => {
  authenticate({
    provider: "web3Auth",
    chainId: "avalanche testnet",
    clientId:
      "BIZUHgiCZ0LYpEEzCrFD5-bkwbuWtmz89dS2sXS5JtbFUVl_EosLT7iVS6bZEROSKUq3hWLWY_l5x1c1pfsYwQc",
  }).then((data) => {
    let payload = {
      provider: "web3Auth",
      chainId: "avalanche testnet",
      clientId:
        "BIZUHgiCZ0LYpEEzCrFD5-bkwbuWtmz89dS2sXS5JtbFUVl_EosLT7iVS6bZEROSKUq3hWLWY_l5x1c1pfsYwQc",
    };
    localStorage.setItem("providerDetail", JSON.stringify(payload));
    dispatch({
      type: authConstants.PROVIDER_ADDED,
      payload,
    });
  });
};

here is my code, it just stops there, nothing happens

Do I need to provide host?

Are you getting any errors?

no , It just does nothing but when I remove chainId field, authentication occurs and I believe this is to etheruem cos I cannot interact with my smartcontracts later

Hm, I am not sure then, looks like people have had issues with this in the past (Web3auth Provider with avalanche chainId?). Sorry but I do not know what is wrong :confused:

does it work with other chain id, like the one for rinkeby (Moralis.Chains.ETH_RINKBEY)?

also, you can look at this tutorial:

My contract is on Avalanche so no need for rinkeby . not providing a chain id defaults to ethereum but I later encounter issues during smart contract interaction which is cos the function is being executed on ethereum

Can you help with walletconnect error, it keep showing cors error

the tutor did not make use of chain ID here

Let me update moralis, maybe that would help