Hi, I’m currently using react-moralis in my project, but I don’t know how to modify the authentication message in the metamask, can somebody help me with that? thanks!
Hey @tigerkev
In react Moralis you can just add into the code:
Moralis.getSigningData = () => "Custom message";
Thanks for the help, I added the code like this, but it seems not working, did I mistake something?
import { useMoralis } from "react-moralis";
function App() {
const { authenticate, isAuthenticated, logout, user, Moralis } = useMoralis();
if (isAuthenticated) {
return (
<>
<Button onClick={() => logout()}>Logout</Button>
<p>User Name: {user.get("username")}</p>
<p>User Address: {user.get("ethAddress")}</p>
{Moralis.getSigningData = () => "Custom message"}
{console.log(user)}
</>
);
}
Hey @tigerkev
Input (Moralis.getSigningData = () => "Custom message")
on the top of the function:
import { useMoralis } from "react-moralis";
export default function App() {
const { authenticate, isAuthenticated, logout, user, Moralis } = useMoralis();
Moralis.getSigningData = () => "Custom message"
return(
<>
</>
)
}
Thanks, it works , thank you very much!
1 Like
I’ve done but it’s still not working. ><
1 Like
Latest version of the SDK has a bug that is not setting this correctly, trying to push a fix today
2 Likes
We fixed the bug - new way of doing this Moralis.authenticate({signingMessage:"hello"})
1 Like
Hey Ivan, this function is not returning the response. Could you assist me with this?
did you use it with await Moralis.authenticate
?