How to detect change of metamask account

What should I do if user changes their metamask account ? Right now , they can just change the account and it keeps saying it’s Authenticated ./ Even if I refresh the page .
Is there a logic for this ?

the user stays authenticated with the initial eth address that was used, you can know when the user changed the metamask account, for example with Moralis.accountsChanged.

If user changes the metamask account, you can ignore it, for example the user could choose a different address to send a transaction if he wants, or you can ask him if he wants to link the new eth address to his account. It depends on your application.

thank you for the quick answer