This demonstrates how to cleanly detect MetaMask or MetaMask Flask and authorize multiple EVM accounts. It allows the user to authorize multiple accounts, add more accounts at any time, and even trigger a fresh request after switching the "active" account in MetaMask. However, it does not attempt to verify signatures or store any information.
View code on GitHub