[Ethereum] How to create a MetaMask Connect request to auth a wallet with MetaMask

metamaskweb3js

I am looking for how to authenticate completely in the browser with MetaMask, presumably by having it sign with some private keys and prove that the user owns a wallet that lists the corresponding public keys.

Every online tutorial I have found speaks about a more strange-looking dialog, which MetaMask uses to confirm signing an arbitrary string. What I want, however, is the dialog found on veritaseum.com:

Metamask Connect Dialog

It's clearly possible, but I can't find what APIs to use to call it. It looks like oAuth, except that I bet the domain, name and icon come from being hosted on some server under my control, while the title and icon of the account is coming from the MetaMask extension.

Can you please post the actual code snippet to make this work, using MetaMask API or maybe web3 can do it?

Best Answer

You can use ethereum.enable() to allow a site to access the account info. For more info see: https://metamask.github.io/metamask-docs/Advanced_Concepts/Provider_API https://medium.com/metamask/eip-1102-preparing-your-dapp-5027b2c9ed76

Related Topic