In the desktop browser there is no problem, but in mobile browsers, when I login using web3auth, when I select metamask, I connect the account, and it automatically returns to my webapp, but the login process is not finished yet. I have to go back to the metamask app, click Sign, and then I can get into the webapp.
Is there any way to prevent my webapp from calling back after hitting connect, and before signing?
when I login using web3auth, when I select metamask
Do you mean when connecting MetaMask via the external wallet option? Are you using moralis-v1? If so you could try using a combination of enableWeb3 and authenticate() to first get the connection working with MetaMask (site connection request) and then redirect back to it from your app to do the signature request.
enableWeb3 would need to be used before authenticate.
enableWeb3() - site connection request
authenticate() - site connection request and signature request
So the idea is to try change the flow - enableWeb3() > connect account in wallet > return to web app > authenticate() > go back to wallet to sign - this is how it can be done with WalletConnect on mobile browsers/wallets.
This WalletConnect demo demonstrates it (you can check page source) but it may not work the same way with Web3Auth.
It hasn’t worked for me with Web3Auth. Anyway, the flow is the one I mentioned at the beginning, but the second time it doesn’t do it automatically.
Anyway, the flow is the one I mentioned at the beginning, but the second time it doesn’t do it automatically.
Can you explain this more, I’m not sure what you mean.
Yes it looks like it doesn’t work, if you run enableWeb3(), you can get the prompt through to Web3Auth > MetaMask to connect the site but then Web3Auth no longer shows the modal again after that with another enableWeb3() or authenticate() (which kind of makes sense, the connection succeeded).
I’m not sure there is a workaround there. You could add a message maybe saying to return to the mobile app.