Moralis.User stays logged in from previous address


While following your rarible clone tutorial, I ran into something that I think is a problem. Basically, when I switch to a different address in the local blockchain and start up localhost again, I am prompted to connect with this new account and after I connect, I am connected to the previous address’s Moralis account with the name and avatar and all. Only after I log out and try to connect back I am given a new account with random username. Why is the previous account still accessible and is getting logged in.

Thank you

Hey @artunb

Authentication via moralis is not tied to blockchain. If your auth session is active it will login you from your last logged account. In your code before login there is something like: user = Moralis.User.current();, isn’t it?

Yes it is. That clears it, thank you.

1 Like