status-im / status-mobile

a free (libre) open source, mobile OS for Ethereum
https://status.app
Mozilla Public License 2.0
3.89k stars 984 forks source link

No permissions requested when changing account in Zerrion Dapp #10288

Closed Serhy closed 4 years ago

Serhy commented 4 years ago

Bug Report

Problem

When account is changed in Zerion Dapp - there is no request to grant permissions for address asked. Also, after page refreshed the address in Dapp is different to account which is selected There is no problem with simpledapp.eth or cryptokitties or pay.sablier.finance but Zerion

Expected behavior

When different account selected in Zerion then page reloads and permission to different account is asked. Cookies flushed after that so the address value pick up that different account address

Actual behavior

When different account selected in Zerion then page reloads but NO permission to different account is asked. Address keep staying the same it was before

Screenshot 2020-04-07 at 14 24 16

Reproduction

jrainville commented 4 years ago

@Serhy I just tested the Zerion Dapp in Metamask and the same behaviour happens.

The problem is with the Dapp itself, and not with Status. A Dapp should watch for account changes and then react accordingly. That's why Cryptokitty and Sablier don't have the issue.

One way to fix it inside Status would be to force refresh the Dapp when we switch accounts, but it is not something we should do. Metamask did do that before, but they stopped because it was bad UX to force a refresh. Here is how they recommend Dapps check the accounts: https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#ear-listening-for-selected-account-changes

Also, in Embark we handle the account changes for the Dapp, but Zerion doesn't use Embark, it uses Truffle.

So, IMO, we should move this issue to the Zerion repo: https://github.com/zeriontech/defi-sdk