How to check if user manually disconnected

Hi all,
I’m implementing Moralis on my website for Web3 integration.
Currently, if I login via metamask using Moralis.Authenticate() and then on Metamask I disconnect my account from the website, calling Moralis.User still returns my current MM address, as if I’m still logged in.

Since my “connect wallet” button should show a modal to choose the provider if I’m not connected, and should show a modal with a logout button if I’m still connected, how do I know if a user manually disconnected MM without using the Moralis.Logout() function?

there is a difference in the authentication with Moralis.authenticate and metamask connection.

you could authenticate even without using metamask, like using username and password

you could try to use Moralis.enableWeb3() before doing something that requires a web3 instance

1 Like