Link Address (non-crypto)

I’m attempting to link the current address every time the user(non-crypto) connects to metamask… I signed the message but it is not updating the database:

    const web3mm = async () =>{ 
      await Moralis.enable();
      await Moralis.link(window.ethereum._state.accounts[0])
    }

Do you see any error in your browser console?
What is that you expect to see in the database and you don’t see?

The selected address added to the accounts array

ok, any errors in your browser console?
console.log(window.ethereum._state.accounts[0]) works fine for you if you type it in your browser console?

Yes that’s working fine

authentication with MetaMask would work fine for you?

Idk about that, I’m logged in through non-crypto (react-moralis) but I connect to metamask through

const Moralis = require('moralis')
const web3 = async () =>{ 
    await Moralis.enable();
    await Moralis.link('0xAb97Bf09F0F404f9dc271314bb09Dd0f097C990A')
  }
<Button onClick={web3}>Connect</Button>

and how far you get with that link? does MetaMask pop up, do you sign that message?

I am not getting the pop up message right now

I switched it to:

    const web3 = async () =>{ 
      await Moralis.enable().then(async () => await Moralis.link(window.ethereum._state.accounts[0]));
    }

This gave me the metamask popup but once signed it did not update database

What version of Moralis SDK are you using?
you can find it out by running: Moralis.CoreManager.get("VERSION")

ā€œmoralisā€: ā€œ^0.0.110ā€,

I have 0.0.124, but your version doesn’t look too old.

how do you check what it is in accounts array?

Under the Users object database

if you look at this example that uses react, https://github.com/ethereum-boilerplate/ethereum-boilerplate, does it help you?

Ethereum-Boilerplate says nothing about linking addresses… I also kind of need to keep it vanilla JS because I’m already connected with login() (non-crypto)

Will I be able to use Moralis.transfer() without an account saved under User?

I think that you should be able to do a transfer without having an address associated with a Moralis account. But you should use Moralis.enableWeb3()

I saw this and I thought that you are not using vanilla js.