Connect wallet on Email Login

Hi, I’m trying to connect the user who registered with email/username with their metamask. However, whenever I try to use Moralis.authenticate(); It generates new user.

You can use Moralis.link(eth_address): https://docs.moralis.io/moralis-server/users/merging-addresses

How do I get the account value? The triggering point in the tutorial is Moralis.onAccountsChanged

What if I want to trigger it using a button?

How do I get the account value?

Ask user to input it manually or use web3.eth.getAccounts()

<button onClick={() => Moralis.link(eth_address) }>Link Account</button>