Help understanding moralis authentication

If I have created 2 users with 2 different addresses. Is it possible to update the current user object when changing the accounts from metamask without calling the authenticate function?

My current workaround is when ever the active account is changed from metamask. using the Moralis.Web3.onAccountsChanged event I call the logout function and call the authenticate function.

usually you don’t want to do that automatically, and you may want to ask the user if he wants to login with the new account or to remain authenticated with the current account when Moralis.Web3.onAccountsChanged is triggered.

A user can stay authenticated with an address and another address can be selected in MetaMask after authentication.

1 Like