How to detect an account change in Metamask?

If a user changes their connected account on their Metamask (or other injected wallet), Web3Auth is not detecting it for me.
Any workaround?

Hey @nico

Which library are you using for interacting with the blockchain? I think it will be either one of web3 or ethers

They both support the EIP1193 provider which is returned by Web3Auth. Check this link for the particular events for this detection: No Longer Reloading Pages on Network Change | by Erik Marks | MetaMask | Medium

Hey @yashovardhan, sorry for my late reply. I’m using Ethers, how can I implement the event listening?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.