You can use Moralis.link()
if you use the same type of authentication in this tutorial.
For example with the React client:
async function link() {
await enableWeb3();
const { account, chainId } = Moralis;
if (!account) {
throw new Error(
'Connecting to chain failed, as no connected account was found'
);
}
if (!chainId) {
throw new Error(
'Connecting to chain failed, as no connected chain was found'
);
}
// Get message to sign from the auth api
const { message } = await Moralis.Cloud.run('requestMessage', {
address: account,
chain: parseInt(chainId, 16),
network: 'evm',
});
await Moralis.link(accountstringyouwanttolinkhere, {
signingMessage: message,
}).catch((err) => {
console.log('err', err);
});
}