SafeEventEmitterProvider is null after refresh when using @web3auth/node-sdk

Hello guys,

I'm using @web3auth/node-sdk to handle login but after login success and refresh I see provider is null

useEffect(() => {
const init = async () => {
try {
// Initialising Web3Auth Node SDK
const web3authNode = new Web3Auth({
clientId, // Get your Client ID from Web3Auth Dashboard
chainConfig: {
chainNamespace: “eip155”,
chainId: “0x1”,
rpcTarget: “https://rpc.ankr.com/eth”, // needed for non-other chains
},
});
setWeb3authNode(web3authNode);
await web3authNode.init({
network: “testnet”,
});

    // Initialising Web3Auth Core SDK
    const web3authCore = new Web3AuthCore({
      clientId,
      chainConfig: {
        chainNamespace: CHAIN_NAMESPACES.EIP155,
        ...chainConfig,
      },
    });

    const openloginAdapter = new OpenloginAdapter({
      loginSettings: {
        mfaLevel: "default",
      },
      adapterSettings: {
        network: "testnet",
        uxMode: "redirect",
        loginConfig: {
          jwt: {
            name: "Web3Auth One Key Login Flow",
            verifier,
            typeOfLogin: "jwt",
            clientId,
          },
        },
      },
    });
    web3authCore.configureAdapter(openloginAdapter);
    setWeb3authCore(web3authCore);
    await web3authCore.init();

    if (web3authCore.provider) {
      setProvider(web3authCore.provider);
    }
  } catch (error) {
    console.error(error);
  }
};

init();

}, []);

How can I restore the provider?



Originally posted by: tranbathanhtung

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/959

Hey there, the @web3auth/node-sdk is created to integrate Web3Auth in NodeJS Backend. For Frontend, I highly recommend using @web3auth/modal or @web3auth/core.
The code snippet which you have pasted will remain, the only difference will be to import Web3Auth from one of the frontend SDKs. Here are code examples for the SDKs to help you quickly setup.



Originally posted by: Saviour1001