Using web3auth in Moralis

hi I’m trying to integrate web3auth into react moralis and so far it’s been working great. but when I closed the web3auth modal without user authentication, moralis auth state is still isAuthenticating: true which prevents from opening up a modal again when click sign-in.

is there away to stop this authenticating process? simply logout() wouldn’t work

1 Like

i think in this will be complicated because both moralis and web3auth use their own login flows and offer there own provider which you use with web3.js or ethers.j set. i cant say without seeing your code but does metmask popup before you closed the modal? if it does then maybe its waiting for you to sign or reject the onboarding message there

well, below is my code and wonder if there’s away to fix that error

  await authenticate({
                    provider: "web3Auth",
                    clientId: process.env.REACT_APP_WEB3_AUTH_CLIENT_ID,
                    chainId: Moralis.Chains.POLYGON_MUMBAI,
                    onError: (error) => console.log('error :>> ', error),
                    onSuccess: (user) => console.log('user :>> ', user),
                    onComplete: (complete) => console.log('complete :>> ', complete)
                  });
Error: Cannot execute Moralis.enableWeb3(), as Moralis Moralis.enableWeb3() already has been called, but is not finished yet 

@cryptokid any advice on this? thank you!

Hi.
Did you manage to fix this? I’m having the same problem

check this out
Web3Auth.io x Moralis: “@web3auth/web3auth” not installed, please install