Access with metamask

How can I log in with metamask on an account already created with email, with which I have just logged in without using the metamask function?
I was trying to log in with metamask through an account with which I was already logged in, but when I use the authenticate () function, it creates a new account for me, so I don’t know how to enter the metamask account data in the account of that user who has only the e-mail for now

you can use for that:

wait, i dont want to change the metamask account, I want that when the user presses the button to log in with metamask, the metamask screen appears as with the authenticate () function, except that I cannot use that function since that the user is already registered with the email and the authenticate function creates a new user; I only need the data in the database of the user who pressed the button to be updated with the metamask data, I don’t know if I have made myself clear.
I tried with the function but nothing appears and to make it work I have to manually change the account


  • there is account a that was registered with user a and password b
  • for the account a, we want to also have an authentication with metamask, so that the same account a can login with MetaMask for with username and password

In this case I would expect for to work, as should only add a new address to current account. You don’t need to change the metamask account, you only have to get the ETH Address from current metamaks account (web3 = await Moralis.enamebleWeb3() and from web3 you can get that address)

okay so can i write stuff like that?

   const account = await Moralis.enableWeb3();

but how do i get the metamask address?

not really like that, you could do something like this: await web3.eth.getAccounts())[0])

1 Like