Verify EVM challenge
curl --request POST \
--url https://authapi.moralis.io/challenge/verify/evm \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "defi.finance wants you to sign in with your Ethereum account:\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\n\n\nURI: https://defi.finance\nVersion: 1\nChain ID: 1\nNonce: Px7Nh1RPzlCLwqgOb\nIssued At: 2022-11-30T10:20:00.262Z",
"signature": "0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c"
}
'import requests
url = "https://authapi.moralis.io/challenge/verify/evm"
payload = {
"message": "defi.finance wants you to sign in with your Ethereum account:
0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
URI: https://defi.finance
Version: 1
Chain ID: 1
Nonce: Px7Nh1RPzlCLwqgOb
Issued At: 2022-11-30T10:20:00.262Z",
"signature": "0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: 'defi.finance wants you to sign in with your Ethereum account:\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\n\n\nURI: https://defi.finance\nVersion: 1\nChain ID: 1\nNonce: Px7Nh1RPzlCLwqgOb\nIssued At: 2022-11-30T10:20:00.262Z',
signature: '0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c'
})
};
fetch('https://authapi.moralis.io/challenge/verify/evm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://authapi.moralis.io/challenge/verify/evm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => 'defi.finance wants you to sign in with your Ethereum account:
0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
URI: https://defi.finance
Version: 1
Chain ID: 1
Nonce: Px7Nh1RPzlCLwqgOb
Issued At: 2022-11-30T10:20:00.262Z',
'signature' => '0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://authapi.moralis.io/challenge/verify/evm"
payload := strings.NewReader("{\n \"message\": \"defi.finance wants you to sign in with your Ethereum account:\\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\\n\\n\\nURI: https://defi.finance\\nVersion: 1\\nChain ID: 1\\nNonce: Px7Nh1RPzlCLwqgOb\\nIssued At: 2022-11-30T10:20:00.262Z\",\n \"signature\": \"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://authapi.moralis.io/challenge/verify/evm")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"defi.finance wants you to sign in with your Ethereum account:\\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\\n\\n\\nURI: https://defi.finance\\nVersion: 1\\nChain ID: 1\\nNonce: Px7Nh1RPzlCLwqgOb\\nIssued At: 2022-11-30T10:20:00.262Z\",\n \"signature\": \"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://authapi.moralis.io/challenge/verify/evm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"defi.finance wants you to sign in with your Ethereum account:\\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\\n\\n\\nURI: https://defi.finance\\nVersion: 1\\nChain ID: 1\\nNonce: Px7Nh1RPzlCLwqgOb\\nIssued At: 2022-11-30T10:20:00.262Z\",\n \"signature\": \"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c\"\n}"
response = http.request(request)
puts response.read_body{
"id": "fRyt67D3eRss3RrX",
"domain": "defi.finance",
"uri": "https://defi.finance/",
"version": "1.0",
"nonce": "0x1234567890abcdef0123456789abcdef1234567890abcdef",
"profileId": "0xbfbcfab169c67072ff418133124480fea02175f1402aaa497daa4fd09026b0e1",
"chainId": 1,
"address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B",
"statement": "Please confirm",
"expirationTime": "2020-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"resources": [
"https://docs.moralis.io/"
]
}Challenge
Verify EVM challenge
POST
/
challenge
/
verify
/
evm
Verify EVM challenge
curl --request POST \
--url https://authapi.moralis.io/challenge/verify/evm \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "defi.finance wants you to sign in with your Ethereum account:\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\n\n\nURI: https://defi.finance\nVersion: 1\nChain ID: 1\nNonce: Px7Nh1RPzlCLwqgOb\nIssued At: 2022-11-30T10:20:00.262Z",
"signature": "0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c"
}
'import requests
url = "https://authapi.moralis.io/challenge/verify/evm"
payload = {
"message": "defi.finance wants you to sign in with your Ethereum account:
0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
URI: https://defi.finance
Version: 1
Chain ID: 1
Nonce: Px7Nh1RPzlCLwqgOb
Issued At: 2022-11-30T10:20:00.262Z",
"signature": "0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: 'defi.finance wants you to sign in with your Ethereum account:\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\n\n\nURI: https://defi.finance\nVersion: 1\nChain ID: 1\nNonce: Px7Nh1RPzlCLwqgOb\nIssued At: 2022-11-30T10:20:00.262Z',
signature: '0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c'
})
};
fetch('https://authapi.moralis.io/challenge/verify/evm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://authapi.moralis.io/challenge/verify/evm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => 'defi.finance wants you to sign in with your Ethereum account:
0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
URI: https://defi.finance
Version: 1
Chain ID: 1
Nonce: Px7Nh1RPzlCLwqgOb
Issued At: 2022-11-30T10:20:00.262Z',
'signature' => '0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://authapi.moralis.io/challenge/verify/evm"
payload := strings.NewReader("{\n \"message\": \"defi.finance wants you to sign in with your Ethereum account:\\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\\n\\n\\nURI: https://defi.finance\\nVersion: 1\\nChain ID: 1\\nNonce: Px7Nh1RPzlCLwqgOb\\nIssued At: 2022-11-30T10:20:00.262Z\",\n \"signature\": \"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://authapi.moralis.io/challenge/verify/evm")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"defi.finance wants you to sign in with your Ethereum account:\\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\\n\\n\\nURI: https://defi.finance\\nVersion: 1\\nChain ID: 1\\nNonce: Px7Nh1RPzlCLwqgOb\\nIssued At: 2022-11-30T10:20:00.262Z\",\n \"signature\": \"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://authapi.moralis.io/challenge/verify/evm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"defi.finance wants you to sign in with your Ethereum account:\\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\\n\\n\\nURI: https://defi.finance\\nVersion: 1\\nChain ID: 1\\nNonce: Px7Nh1RPzlCLwqgOb\\nIssued At: 2022-11-30T10:20:00.262Z\",\n \"signature\": \"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c\"\n}"
response = http.request(request)
puts response.read_body{
"id": "fRyt67D3eRss3RrX",
"domain": "defi.finance",
"uri": "https://defi.finance/",
"version": "1.0",
"nonce": "0x1234567890abcdef0123456789abcdef1234567890abcdef",
"profileId": "0xbfbcfab169c67072ff418133124480fea02175f1402aaa497daa4fd09026b0e1",
"chainId": 1,
"address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B",
"statement": "Please confirm",
"expirationTime": "2020-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"resources": [
"https://docs.moralis.io/"
]
}Body
application/json
Verify EVM challenge message.
Message that needs to be signed by the end user.
Example:
"defi.finance wants you to sign in with your Ethereum account:\n0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B\n\n\nURI: https://defi.finance\nVersion: 1\nChain ID: 1\nNonce: Px7Nh1RPzlCLwqgOb\nIssued At: 2022-11-30T10:20:00.262Z"
Response
201 - application/json
The token to be used to call the third party API from the client

