I try to link address (new) to existing username, password login

here is my code

async function linkwallet(){
  init();
  const out = await Moralis.link(web3.eth.getAccounts().then(e => { 
    return e[0];
   }) , { signingMessage: "Custom Linking Message"})
};

and the error shows that
Uncaught (in promise) TypeError: account.toLowerCase is not a function


and it does not update the table in the server

the step will be 1) signup to Moralis with email and password
2) login
3) link to wallet

Could you Call this function individually and see what response format you’re getting. The link function only accepts a string.

You can take reference from here -
https://docs.moralis.io/moralis-server/users/merging-addresses#linking-elrond-address

its return promise array and I already try with individual call it still the same.

What you get for something like this:

x = await web3.eth.getAccounts();
y = x[0];
console.log(y);
const out = await Moralis.link(y, { signingMessage: “Custom Linking Message”});

Do you also have latest Moralis SDK version?

I got this error instead

“Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘getAccounts’)”

I got “moralis”: “^0.0.54”,

this looks like a super old version :slight_smile:

1 Like

Okie I will update it :smiley:

@cryptokid I got this error Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘linkWith’) instead

@cryptokid Oh it work now Thank you :smiley::smiley:

is it gonna be problem if one wallet address can link to multiple user name or should I have some checking on it? with Moralis.link -> it can link 1 wallet address with multiple username.

So, if you link one wallet address with multiple user names, then what happens if you try to authenticate with that wallet address?

I can authenticate both username, so that mean Moralis.link is not have the case to check the accounts that has previously link, right