1

Having a bit of a road block in my development process. I want to create an application where a user signs in through metamask, and has their owned NFTs displayed.

In the MetaMask api, I found this https://docs.metamask.io/guide/getting-started.html#connecting-to-metamask

const ethereumButton = document.querySelector('.enableEthereumButton');
const showAccount = document.querySelector('.showAccount');

ethereumButton.addEventListener('click', () => {
  getAccount();
});

async function getAccount() {
  const accounts = await ethereum.request({ method: 'eth_requestAccounts' });
  const account = accounts[0];
  showAccount.innerHTML = account;
}

This works great, and I am able to receive the accounts[0] with Javascript, to see the wallet address of the user.

The main issue I am having is how to verify the user owns the wallet. Am I missing a big step in the process?

1 Answer 1

0

For signing using MetaMask check out Sign in with Ethereum project.

Don't try to build your own authentication mechanism unless you know what you are doing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.