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 Moralis.link(eth_address) for that: https://docs.moralis.io/moralis-server/web3/web3#linking

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 Moralis.link function but nothing appears and to make it work I have to manually change the account

assumptions:

  • 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 Moralis.link to work, as Moralis.link 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();
    await Moralis.link(account);

but how do i get the metamask address?

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

1 Like

Hello. Were you able to resolve this issue? I can’t login to my Metamask wallet. I couldn’t find the answer to the question How to Change Metamask Password?

I don’t know how you could reset the MetaMask password. Maybe you can uninstall it and then install it again.

Thank yok. :slightly_smiling_face:

1 Like