Origin not allowed

Hi @vjgee

I am getting following error while opening web3auth model

Error: WebSocket connection closed abnormally with code: 3000 (Unauthorized: origin not allowed)
at ibe.onClose (index-6dc07298.js:132:5807)
at _n. (index-6dc07298.js:132:6448)
at _n.emit (index-6dc07298.js:85:18626)
at cbe.onClose (index-6dc07298.js:132:8941)
at t.onclose (index-6dc07298.js:132:8809)

this is very urgent… we are live now and getting this error in production

hi @psaini.php,

can you send us more information ?

SDK Version(package.json):

  • Platform:
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken (JWT):

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

  • SDK Version: v7.3.2

  • Platform: Reactjs

    @walletconnect/sign-client”: “^2.10.6”,
    @web3auth/base”: “^7.3.2”,
    @web3auth/modal”: “^7.3.2”,
    @web3auth/wallet-connect-v2-adapter”: “^7.3.2”,

 const [web3auth, setWeb3auth] = useState(null);
  const [provider, setProvider] = useState(null);
  const [loggedIn, setLoggedIn] = useState(false);
  const [address, setAddress] = useState("");

  useEffect(() => {
    const init = async () => {
      try {
        localStorage.removeItem("Web3Auth-cachedAdapter");
        const web3auth = new Web3Auth({
          clientId,
          chainConfig: flareConfig,
          web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
        });

        // adding metamask adapter
        const metamaskAdapter = new MetamaskAdapter({
          clientId,
          sessionTime: 3600, // 1 hour in seconds
          web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
          chainConfig: flareConfig,
        });
        // we can change the above settings using this function
        metamaskAdapter.setAdapterSettings({
          sessionTime: 86400, // 1 day in seconds
          chainConfig: flareConfig,
          web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
        });

        // it will add/update  the metamask adapter in to web3auth class
        web3auth.configureAdapter(metamaskAdapter);

        const defaultWcSettings = await getWalletConnectV2Settings(
          CHAIN_NAMESPACES.EIP155,
          [chainIdNum],
          import.meta.env.VITE_WALLET_CONNECT_ID
        );

        console.log('wallet connect', import.meta.env.VITE_WALLET_CONNECT_ID)

        const walletConnectV2Adapter = new WalletConnectV2Adapter({
          adapterSettings: { ...defaultWcSettings.adapterSettings },
          loginSettings: { ...defaultWcSettings.loginSettings },
        });

        web3auth.configureAdapter(walletConnectV2Adapter);

        setWeb3auth(web3auth);

        await web3auth.initModal({
          modalConfig: {
            [WALLET_ADAPTERS.OPENLOGIN]: {
              label: "openlogin",
              loginMethods: {
                // Disable facebook and reddit
                facebook: {
                  name: "facebook",
                  showOnModal: false,
                },
                reddit: {
                  name: "reddit",
                  showOnModal: false,
                },
                google: {
                  name: "google",
                  showOnModal: false,
                },
                discord: {
                  name: "discord",
                  showOnModal: false,
                },
                twitch: {
                  name: "twitch",
                  showOnModal: false,
                },
                apple: {
                  name: "apple",
                  showOnModal: false,
                },
                line: {
                  name: "line",
                  showOnModal: false,
                },
                github: {
                  name: "github",
                  showOnModal: false,
                },
                kakao: {
                  name: "kakao",
                  showOnModal: false,
                },
                linkedin: {
                  name: "linkedin",
                  showOnModal: false,
                },
                twitter: {
                  name: "twitter",
                  showOnModal: false,
                },
                weibo: {
                  name: "weibo",
                  showOnModal: false,
                },
                wechat: {
                  name: "wechat",
                  showOnModal: false,
                },
                sms_passwordless: {
                  name: "sms_passwordless",
                  showOnModal: false,
                },
              },
            }, //Disable Torus Plugin
            [WALLET_ADAPTERS.TORUS_EVM]: {
              label: "TORUS_EVM",
              showOnModal: false,
            },
            [WALLET_ADAPTERS.WALLET_CONNECT_V2]: {
              label: "WALLET_CONNECT_V2",
              showOnModal: true,
            },
          },
        });

        setProvider(web3auth.provider);
      } catch (error) {
        console.log("wallet--init--catch", error);
        toast.error(
          "Web3auth not initialized yet, please reload your browser",
          {
            position: toast.POSITION.BOTTOM_RIGHT,
            toastId: "web3auth_toast",
          }
        );
      }
    };

    init();
  }, []);


const isConnected = async () => {
    if (!web3auth) {
      console.log("web3auth not initialized yet--isConnected");
      return false;
    }
    return web3auth.status === "connected";
  };

  const web3Login = async () => {
    if (!web3auth) {
      console.log("web3auth not initialized yet");
      return;
    }
    const web3authProvider = await web3auth.connect();
    setProvider(web3authProvider.provider);
    const connectedStatus = web3auth.status === "connected";
    if (connectedStatus) {
      setLoggedIn(true);
      await getImmediateAccounts(web3authProvider.provider);
    }
  };

  const web3logout = async () => {
    if (!web3auth) {
      console.log("web3auth not initialized yet");
      return;
    }
    await web3auth.logout();
    setLoggedIn(false);

    const web3authProvider = await web3auth.logout();
    setProvider(web3authProvider);
    setAddress("");
    setLoggedIn(false);
  };

  const getImmediateAccounts = async (provider) => {
    if (!provider) {
      console.log("web3auth not initialized yet");
      return;
    }
    const rpc = new RPC(provider);
    const acc = await rpc.getAccounts();
    setAddress(acc);
    return acc;
  };

  const getAccounts = async () => {
    if (!provider) {
      console.log("web3auth not initialized yet");
      return;
    }
    const rpc = new RPC(provider);
    const acc = await rpc.getAccounts();
    setAddress(acc);
    return acc;
  };

VITE_WEB3AUTH_CLIENT_ID=‘’

VITE_CHAINID_NUM=14

VITE_CHAINID=‘0xE’

VITE_RPC_TARGET=‘https://flare-api.flare.network/ext/C/rpc

VITE_DISPLAY_NAME=‘Flare’

VITE_BLOCK_EXPLORER=‘https://flare-explorer.flare.network/

VITE_TICKER=‘FLR’

VITE_TICKER_NAME=‘FLR’

VITE_WALLET_CONNECT_ID=‘’

@TomTom @vjgee

hi @psaini.php,

Can you share with me the online link and how to make it fail ? or when its showing to you this error ?

also I recommend you to edit the previous post to remove your clientId.

https://uppercent.com/


click on connect wallet button then choose option connect with wallet…

sometimes it works… sometime not

check browser console for error

@TomTom

@vjgee could you please look into this

Hi @vjgee @TomTom is anyone available right now? We are live now… we have to fix it on urgent basis.

@psaini.php I am able to login with Wallet Connect on https://uppercent.novvr.com/ but not on uppercent.com. Is there anything different you have setup on your Production site?

@vjgee Integration is same but chain is different. https://uppercent.novvr.com is one coston2 or SGB but https://uppercent.com is on Flare mainnet. web3auth client id is different… walletconnect project id is different

VITE_WEB3AUTH_CLIENT_ID=‘’

VITE_CHAINID_NUM=14

VITE_CHAINID=‘0xE’

VITE_RPC_TARGET=‘https://flare-api.flare.network/ext/bc/C/rpc

VITE_DISPLAY_NAME=‘Flare’

VITE_BLOCK_EXPLORER=‘https://flare-explorer.flare.network/

VITE_TICKER=‘FLR’

VITE_TICKER_NAME=‘FLR’

VITE_WALLET_CONNECT_ID=‘’

@psaini.php Can you replace the RPC target with https://rpc.ankr.com/flare and check

@vjgee I have verified all domain for web3auth and walletconnect both but I don’t know why it is saying " origin not allowed"

ok but it will ask everyone on metamask to approve & switch to new chain.

@psaini.php I believe your walletconnect configuration is incorrect. Have you setup a Project ID on https://cloud.walletconnect.com. Can you share the settings you have here?

Ok, do not make any change yet.

I have changed… could you please try it

how should I share ? should I share screenshot ?




@vjgee

I will have to check but the issue is happening from WalletConnect configuration. Provide some time to check .

Can you remove these domains added to the allow list since all origins are allowed by default?

ok… but in this case… anyone can use our account if they have our project id correct?

Can you first check the behavior ?