Email Login Error: Must provide fallback error with integer number code and string message

Hi Team,

I’m having the following error while logging in with an email address.

  • SDK Version(package.json): “^7.3.0”
  • Platform: Chrome
  • Browser Console Screenshots:

Hey @ezekaemmanuel1710 can you please share the initialization code, and login code?

Hi @Ayush , Thank you for your response.

Below is the initialization code

  useEffect(() => {

    const initializeWeb3Auth = async () => {
      try {
        const web3auth = new Web3Auth({
          clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID as string,
          web3AuthNetwork:
            process.env.NODE_ENV === "production" ? "mainnet" : "testnet",
          chainConfig: {
            chainNamespace: "eip155",
            chainId: process.env.NEXT_PUBLIC_POLYGON_CHAIN_ID,
          },
        });
        // await web3auth.initModal();

        await web3auth.initModal({
          modalConfig: {
            [WALLET_ADAPTERS.OPENLOGIN]: {
              label: "openlogin",
              loginMethods: {
                google: {
                  name: "google login",
                  logoDark:
                    "url to your custom logo which will shown in dark mode",
                },
                facebook: {
                  // it will hide the facebook option from the Web3Auth modal.
                  name: "facebook login",
                  showOnModal: false,
                },
              },
              // setting it to false will hide all social login methods from modal.
              showOnModal: true,
            },
          },
        });
        dispatch(setWeb3Auth(web3auth));
      } catch (error) {
        console.log(error);
      }
    };

    initializeWeb3Auth();
  }, []);

Below is the login code:

const login = async () => {
  const dispatch = store.dispatch;
  const {
    web3Auth: { provider, web3Auth: web3auth },
  } = store.getState() as RootState;
  if (web3auth?.status === "connected") {
    dispatch(setProvider(web3auth.provider)); 
  } else {
    const connectedProvider = await web3auth.connect();
    dispatch(setProvider(connectedProvider));
  }
};

Hey @ezekaemmanuel1710

Can you specify which SDK you are currently using? If it is Web3Auth Modal SDK, you are on quite an old version of it. Please make sure you have updated to the latest v8.7

Additionally, I see your chain config is incomplete

chainConfig: {
            chainNamespace: "eip155",
            chainId: process.env.NEXT_PUBLIC_POLYGON_CHAIN_ID,
          },

Please make sure you are following the chainConfig mentioned here: https://web3auth.io/docs/connect-blockchain/evm/polygon/web

Additionally, your modal config seems incorrect, I see the logo dark field, which is supposed to be a URL, has a random string over there. I’d recommend you to ideally delete the extra modal config fields that are not required.

Also try adding a try catch block in your login code, it will help you know if the error is being emitted on login or not.