Check the user wallet is still connected

Hi All,
I connected my wallet using Moralis.authenticate({signingMessage: “Meta Login”}) . Now I am using Moralis.User.current(); to get info on user wallet. But when I disconnect the application from the wallet manually. It still shows user info from Moralis.User.current(); But I have disconnected the application/website. Is there any way I can find out if the wallet is still connected?

the wallet/metamask is connected separately from the authentication, it is needed for the authentication, but you can use it with web3 = await Moralis.enableWeb3() without authentication too.

if you use logout then Moralis.User.current() will not work any more, but if you only change the wallet in metamask, then you can still be authenticated.

you can read current chain, and address that is associated with metamask:
await web3.eth.net.getId() for the chain for example

1 Like