curl --request POST \
--url https://authapi.moralis.io/challenge/verify/aptos \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "defi.finance wants you to sign in with your Aptos account:\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\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/aptos"
payload = {
"message": "defi.finance wants you to sign in with your Aptos account:
0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d
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 Aptos account:\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\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/aptos', 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/aptos",
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 Aptos account:
0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d
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/aptos"
payload := strings.NewReader("{\n \"message\": \"defi.finance wants you to sign in with your Aptos account:\\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\\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/aptos")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"defi.finance wants you to sign in with your Aptos account:\\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\\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/aptos")
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 Aptos account:\\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\\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",
"network": "mainnet",
"address": "0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d",
"publicKey": "0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d",
"statement": "Please confirm",
"expirationTime": "2020-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"resources": [
"https://docs.moralis.io/"
]
}Verify Aptos challenge
curl --request POST \
--url https://authapi.moralis.io/challenge/verify/aptos \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "defi.finance wants you to sign in with your Aptos account:\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\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/aptos"
payload = {
"message": "defi.finance wants you to sign in with your Aptos account:
0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d
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 Aptos account:\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\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/aptos', 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/aptos",
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 Aptos account:
0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d
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/aptos"
payload := strings.NewReader("{\n \"message\": \"defi.finance wants you to sign in with your Aptos account:\\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\\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/aptos")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"defi.finance wants you to sign in with your Aptos account:\\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\\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/aptos")
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 Aptos account:\\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\\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",
"network": "mainnet",
"address": "0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d",
"publicKey": "0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d",
"statement": "Please confirm",
"expirationTime": "2020-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"resources": [
"https://docs.moralis.io/"
]
}Authorizations
Body
Verify Aptos challenge message.
Message that needs to be signed by the end user.
"defi.finance wants you to sign in with your Aptos account:\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\n\n\nURI: https://defi.finance\nVersion: 1\nChain ID: 1\nNonce: Px7Nh1RPzlCLwqgOb\nIssued At: 2022-11-30T10:20:00.262Z"
EIP-191 compliant signature signed by the Aptos account address requesting authentication.
"0xa8f89a58bf9b433d3100f9e41ee35b5e31fb8c7cd62547acb113162ec6f2e4140207e2dfbd4e387e1801ebc7f08a9dd105ac1d22b2e2ff0df5fa8b6d9bdcfe491c"
Response
The token to be used to call the third party API from the client
17-characters Alphanumeric string Secret Challenge ID used to identify this particular request. Is should be used at the backend of the calling service to identify the completed request.
8 - 64^[a-zA-Z0-9]{8,64}$"fRyt67D3eRss3RrX"
RFC 4501 dns authority that is requesting the signing.
"defi.finance"
RFC 3986 URI referring to the resource that is the subject of the signing (as in the subject of a claim).
"https://defi.finance/"
EIP-155 Chain ID to which the session is bound, and the network where Contract Accounts must be resolved.
"1.0"
"0x1234567890abcdef0123456789abcdef1234567890abcdef"
Unique identifier with a length of 66 characters
"0xbfbcfab169c67072ff418133124480fea02175f1402aaa497daa4fd09026b0e1"
The network where Contract Accounts must be resolved.
mainnet, testnet "mainnet"
Aptos address performing the signing conformant.
"0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d"
Aptos public key performing the signing conformant.
"0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d"
Human-readable ASCII assertion that the user will sign, and it must not contain .
"Please confirm"
ISO 8601 datetime string that, if present, indicates when the signed authentication message is no longer valid.
"2020-01-01T00:00:00.000Z"
ISO 8601 datetime string that, if present, indicates when the signed authentication message will become valid.
"2020-01-01T00:00:00.000Z"
List of information or references to information the user wishes to have resolved as part of authentication by the relying party. They are expressed as RFC 3986 URIs separated by `
- `.
["https://docs.moralis.io/"]

