const handleAuth = async (
provider:
| "metamask"
| "coinbase"
| "walletconnect"
| "magicLink"
| "web3Auth" = "metamask"
) => {
activateInjectedProvider(provider);
try {
setAuthError(null);
setIsAuthenticating(true);
// Enable web3 to get user address and chain
await enableWeb3({ throwOnError: true, provider });
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),
networkType: "evm",
});
// Authenticate and login via parse
await authenticate({
signingMessage: message,
throwOnError: true,
});
} catch (error) {
setAuthError(error);
alert("Authentication failed Please try again !");
} finally {
setIsAuthenticating(false);
setIsAuthOpen(false);
}
};
So here in authenticate if I am giving any hardcoded message like āPlease sign inā then it shows an error moralis auth fail
so any idea how can i add the message ?