Logging out User from new Moralis SDK

Hiā€¦
seems my brain is not at his default level:-)

So with the old SDK i was using await Moralis.User.logOut(); everything was fineā€¦ if the user refreshed page nothing happenedā€¦ but now if i using it with the latest SDK absolutly nothing happens. My script still see the logged-in Walletaddress and the Dapp is just loading all the datas ā€¦ (login button disappears, logoutbutton appears) likeā€¦ if the user still is logged in ā€¦

How can i Disconnect the user or clear the MoralisConnection or whatever? This is the function i am using to ā€œdisconnectā€ (wich is not working)

async function onDisconnect() {

  Moralis.deactivateWeb3();

}

The onWeb3Deactivated Listener then calls some other stuff

Moralis.onWeb3Deactivated((result) => {


  Moralis.User.logOut();

  document.querySelector("#prepare").style.display = "block";

  document.querySelector("#connected").style.display = "none";

});

i tried moreā€¦ but dont want to write a bible hereā€¦ in a nutshell ā€¦ logout not working ^^

would be awesome if someone could help me out here :slight_smile: sitting on this since hours

the question is about logging out current user or disconnecting from a wallet? asking because are totally different things

as far as i know a real ā€œlog out from walletā€ is not even possible. But here i am talking about logging out current user.

you say that this doesnā€™t do anything: await Moralis.User.logOut();?

the buttons are displayed based on the login that is executed in current javascript code

how do you check if use is authenticated?

once a user is logged on in and he leaves the website and he comes back later on the website just does await Moralis.enableWeb3();

so onWeb3Enabled triggers

Moralis.onWeb3Enabled((result) => {

 if(result["account"])

 {
  callthewallet(result["account"]);

  document.querySelector("#prepare").style.display = "none";

  document.querySelector("#connected").style.display = "block";

 }
 else
 {

  document.querySelector("#prepare").style.display = "block";

  document.querySelector("#connected").style.display = "none";

 }

});

this works perfectly ā€¦ but if a user clicks the logout button and i call either

Moralis.User.logOut();

or

Moralis.deactivateWeb3();

the user still is logged in . idk if my english is so bad lol but thats what i told in my first request already. If the user visites the website later on again, await Moralis.enableWeb3(); is still able to find the useraddress and so connects the dapp automatically

a user can call enableWeb3 anytime without being logged in, and it should work

anyway, you could also post here in this thread specific to the new version: Moralis JS-SDK v1.0.0 [beta] (Ethers.js support)

assuming that it was working fine before the release of this new version

initially I though that the post was about logging the user out, but it seems to be about disconnecting current wallet, those things are two different things

ok lets assume i am completly wrongā€¦ how can i login a user with the new sdk ā€¦ i mean i am using currently

Moralis.authenticate({signingMessage:"blabla"}).then(function (user) {callthewallet(user.get("ethAddress"))});

to login the user ā€¦

so what do i have to do now, to get him logged out again ā€¦ OR how can i check if he is still connected or disconnected ā€¦ that would solve my problem too

this is how I was checking in previous sdk user = await Moralis.User.current();

lol seems that helped xD thank you buddy