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