How can we detect when a user signs in to MetaMask after the page has loaded? Is it necessary to resort to polling, or is there an event that a page can listen out for?
As of 2020, the web3 site has to ask for account access via ethereum.request({ method: 'eth_requestAccounts' })
, and then listen for changes to the accounts via the accountsChanged
event.
Please see the MetaMask documentation for details.