This auth is already used

When trying to link accounts I get the error “this auth is already used”. After successful linking should I see the second wallet address in the user object addresses array ?Screenshot 2022-01-21 at 07.34.10

how did you do that link?

Like so…

 Moralis.Web3.onAccountsChanged(async ([account]) => {
      console.log('ACCOUNT CHANGED', account);
      if (account.length === 0) {
        console.log('LEN 0');
      } else {
        const confirmed = confirm('Link this address to your account?');
        if (confirmed) {
          const user = await;
         } catch(e) {

and that new address was used by another user before?

It’s possible but my user object addresses array still only has one address for said user should I expect to see more than one if link has worked in the past?. I have tried to link with a number of addresses.

the link should work only with an address that was not used successfully before by another user or by current user for login/link

yes this happen to me too

is there a way to check if the account need to be linked or not? to handle this error

I think that link will fail in that case. You could check if an address was already used or not in a cloud function.

one question, is there a way to connect metamask without sign and register the user in the db?
just authenticate it, I don’t need to register the user in the db, I think this could be lighter for my dapp

You can use enableWeb3() that doesn’t authenticate the user, but he can make transactions

okay thank you
and then you think is a good way check the “account” variable (exported by react moralis) to know if metamask is authenticated?

I don’t know that exact variable in react, but you can get somehow the user address after enableWeb3 was successful

you can read here about how to use react-moralis:

1 Like