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