this format seems strange, maybe it is expected to be with two \
hmm. I changed like this. but it’s not working.
deblog.club wants you to sign in with your Ethereum account:\\0x41Dd2e751dF10b27356cd1790567Ba6C4B5d933b\\\\Please sign this message to confirm your identity.\\\\URI: http://localhost:3000\\Version: 1\\Chain ID: 1\\Nonce: tL8ejuiK6RUFhPXrE\\Issued At: 2022-09-27T16:55:03.381Z
This one is not working as well.
curl --request POST \
--url https://authapi.moralis.io/challenge/verify/evm \
--header 'X-API-KEY: GDlFIJ8uIErqaQCfTQxxxxxxxxxxxxxxxwjmwWb' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"signature": "0x33ab7687c3bf3xxxxxxxxxxxxxxxxxxxx336188a0496c03f161b",
"message": "deblog.club wants you to sign in with your Ethereum account: 0x41Dd2e751dF10b27356cd1790567Ba6C4B5d933b Please sign this message to confirm your identity. URI: http://localhost:3000 Version: 1 Chain ID: 1 Nonce: uuY77ky0uqo4dGhCD Issued At: 2022-09-27T18:56:01.089Z"
}
'
you could try with \n
instead of \\n
maybe this tutorial will help you more
oh yeah. This is nice. I’ll go though this document. Thx!
you could try with
\n
instead of\\n
The error message is slightly different if I send a message with \n
{
"statusCode": 400,
"name": "NotFoundException",
"message": "Challenge not found, Timeout may have exceeded"
}
Why? it’s changed??
there is a timeout for a challenge, that default time of 15 seconds that you could change to more
Even if I set the timeout to 60, the result is all the same.
Also I send the verify request instantly. It’s within a second.
const config = {
domain: process.env.APP_DOMAIN,
statement: 'please ...',
uri: process.env.NEXTAUTH_URL,
timeout: 60,
};
export default async function handler(req, res) {
const { address, chain, network } = req.body;
await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
try {
const message = await Moralis.Auth.requestMessage({
address,
chain,
network,
...config,
});
ok, then not the timeout is the issue, how does the message looks like now?
Now it’s like this
{
"statusCode": 400,
"name": "NotFoundException",
"message": "Challenge not found, Timeout may have exceeded"
}
I mean the request that you send, what is the message there that was signed.
message is like this
"deblog.club wants you to sign in with your Ethereum account:\n0x41Dd2e751dF10b27356cd1790567Ba6C4B5d933b\n\n\nURI: http://localhost:3000\nVersion: 1\nChain ID: 1\nNonce: ub6VkbzlwN
q3ueHBM\nIssued At: 2022-09-28T08:42:01.303Z"
You may need to add more fields to that message, like not before
It’s because just I change the statement to blank when I Moralis.Auth.requestMessage
.
const config = {
domain: process.env.APP_DOMAIN,
statement: '',
uri: process.env.NEXTAUTH_URL,
timeout: 60,
};
So the message is changed only statement part.
Try to test with 55 timeout, it may not matter
And to add more parameters/fields to that config
I changed 55 timeout and added all config listed here. But the response is all the same with 400 error.
and same error message as here?
yeah. I’m thinking I need to take another approach.
I still don’t know why the endpoint is not working for me.
It looks there is no solution.
if you generate a message with the swagger by editing those fields presented there, copy the generated message and try to validate it with an old signature, you get same error?