I have a problem in linking authenticated user’s others account as explained in moralis docs. My current implementation is inside useEffect hook of layout file in nextjs app
useEffect(() => {
Moralis.onAccountChanged(async accountSelected => {
console.log(user?.attributes.accounts)
const isLinked = user?.attributes.accounts.find((acct: any) => acct === accountSelected)
if (!isLinked) {
const confirmed = confirm("Link this address to your account?")
if (confirmed) {
try {
await Moralis.link(accountSelected as string)
} catch (e) {
console.log(e)
}
}
}
})
}, [])
And the error I get inside console is
Error: Insufficient auth.
at handleError (RESTController.js:438:1)
I am not sure what this insufficient auth means. User is already logged in with other account.