I am not sure if something changed, but for the past two years we did not observe this issue until recently.
When user changes to a different account from within MetaMask, our app will NOT receive that information and continues functioning with the previously connected account.
In the following screenshot, notice that I remain connected to CXIP #1, but I switched to CXIP #2 in MetaMask.
0) With all accounts disconnected
1) Initiate connection from within the App by clicking on button [CONNECT WALLET] and connect with Account #1
2) In MetaMask, switch to Account #2
3) Observe that nothing happens, no event is emmited and user keeps connected with Account #1, despite seeing Account #2 in their MetaMask extension
4) For further detail, I present you the connect/disconnect option within MetaMask, where you can see that Account #1 is still Active.
5) Only after pressing the highlighted Connect, only then the App receives an event and is allowed to handle the change.
On this third attachment notice the potential dangerous situation where the user THINKS they are on Account #2, but they are in fact signing transactions with Account #1 with no clear clue other than the account name, which can easily be missed, especially if the user choses poor names.
Unlike in this situation, where it did show a very subtle information, which is so subtle that it's almost useless too anyway. And I don't even know what the circumstances were to see this.
"Is this the correct account? It's different from the currently selected account in your wallet"
I am not sure if something changed, but for the past two years we did not observe this issue until recently.
When user changes to a different account from within MetaMask, our app will NOT receive that information and continues functioning with the previously connected account.
In the following screenshot, notice that I remain connected to
CXIP #1
, but I switched toCXIP #2
in MetaMask.0) With all accounts disconnected 1) Initiate connection from within the App by clicking on button
5) Only after pressing the highlighted ![metamask-switch-disconnect](https://github.com/MetaMask/metamask-docs/assets/2313018/904a75c6-2fa2-446f-a0c8-b103b48a98bd)
[CONNECT WALLET]
and connect withAccount #1
2) In MetaMask, switch toAccount #2
3) Observe that nothing happens, no event is emmited and user keeps connected withAccount #1
, despite seeingAccount #2
in their MetaMask extension 4) For further detail, I present you the connect/disconnect option within MetaMask, where you can see thatAccount #1
is stillActive
.Connect
, only then the App receives an event and is allowed to handle the change.On this third attachment notice the potential dangerous situation where the user THINKS they are on
Account #2
, but they are in fact signing transactions withAccount #1
with no clear clue other than the account name, which can easily be missed, especially if the user choses poor names.Unlike in this situation, where it did show a very subtle information, which is so subtle that it's almost useless too anyway. And I don't even know what the circumstances were to see this.
Compare the two: