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');
        this.logout();
      } else {
        const confirmed = confirm('Link this address to your account?');
        if (confirmed) {
         try{
          const user = await Moralis.Web3.link(account);
          console.log(user);
         } catch(e) {
           console.log(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: https://github.com/MoralisWeb3/react-moralis

1 Like

do you suggest _ActiveSyncStatus and _Sessions must be cleaned up while migrating database from moralis servers to self-hosting?

you can delete them, you donā€™t need them for that migration to self hosting, you can delete them from the self hosted server database too

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.