curl --request POST \
--url https://authapi.moralis.io/challenge/verify/solana \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "defi.finance wants you to sign in with your Solana account:\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\n\nI am a third party API\n\nURI: http://defi.finance\nVersion: 1\nNetwork: mainnet\nNonce: PYxxb9msdjVXsMQ9x\nIssued At: 2022-08-25T11:02:34.097Z\nExpiration Time: 2022-08-25T11:12:38.243Z\nResources:\n- https://docs.moralis.io/",
"signature": "2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny"
}
'import requests
url = "https://authapi.moralis.io/challenge/verify/solana"
payload = {
"message": "defi.finance wants you to sign in with your Solana account:
26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo
I am a third party API
URI: http://defi.finance
Version: 1
Network: mainnet
Nonce: PYxxb9msdjVXsMQ9x
Issued At: 2022-08-25T11:02:34.097Z
Expiration Time: 2022-08-25T11:12:38.243Z
Resources:
- https://docs.moralis.io/",
"signature": "2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny"
}
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 Solana account:\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\n\nI am a third party API\n\nURI: http://defi.finance\nVersion: 1\nNetwork: mainnet\nNonce: PYxxb9msdjVXsMQ9x\nIssued At: 2022-08-25T11:02:34.097Z\nExpiration Time: 2022-08-25T11:12:38.243Z\nResources:\n- https://docs.moralis.io/',
signature: '2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny'
})
};
fetch('https://authapi.moralis.io/challenge/verify/solana', 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/solana",
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 Solana account:
26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo
I am a third party API
URI: http://defi.finance
Version: 1
Network: mainnet
Nonce: PYxxb9msdjVXsMQ9x
Issued At: 2022-08-25T11:02:34.097Z
Expiration Time: 2022-08-25T11:12:38.243Z
Resources:
- https://docs.moralis.io/',
'signature' => '2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny'
]),
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/solana"
payload := strings.NewReader("{\n \"message\": \"defi.finance wants you to sign in with your Solana account:\\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\\n\\nI am a third party API\\n\\nURI: http://defi.finance\\nVersion: 1\\nNetwork: mainnet\\nNonce: PYxxb9msdjVXsMQ9x\\nIssued At: 2022-08-25T11:02:34.097Z\\nExpiration Time: 2022-08-25T11:12:38.243Z\\nResources:\\n- https://docs.moralis.io/\",\n \"signature\": \"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny\"\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/solana")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"defi.finance wants you to sign in with your Solana account:\\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\\n\\nI am a third party API\\n\\nURI: http://defi.finance\\nVersion: 1\\nNetwork: mainnet\\nNonce: PYxxb9msdjVXsMQ9x\\nIssued At: 2022-08-25T11:02:34.097Z\\nExpiration Time: 2022-08-25T11:12:38.243Z\\nResources:\\n- https://docs.moralis.io/\",\n \"signature\": \"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://authapi.moralis.io/challenge/verify/solana")
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 Solana account:\\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\\n\\nI am a third party API\\n\\nURI: http://defi.finance\\nVersion: 1\\nNetwork: mainnet\\nNonce: PYxxb9msdjVXsMQ9x\\nIssued At: 2022-08-25T11:02:34.097Z\\nExpiration Time: 2022-08-25T11:12:38.243Z\\nResources:\\n- https://docs.moralis.io/\",\n \"signature\": \"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny\"\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": "26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo",
"statement": "Please confirm",
"expirationTime": "2020-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"resources": [
"https://docs.moralis.io/"
]
}Verify Solana challenge
curl --request POST \
--url https://authapi.moralis.io/challenge/verify/solana \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"message": "defi.finance wants you to sign in with your Solana account:\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\n\nI am a third party API\n\nURI: http://defi.finance\nVersion: 1\nNetwork: mainnet\nNonce: PYxxb9msdjVXsMQ9x\nIssued At: 2022-08-25T11:02:34.097Z\nExpiration Time: 2022-08-25T11:12:38.243Z\nResources:\n- https://docs.moralis.io/",
"signature": "2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny"
}
'import requests
url = "https://authapi.moralis.io/challenge/verify/solana"
payload = {
"message": "defi.finance wants you to sign in with your Solana account:
26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo
I am a third party API
URI: http://defi.finance
Version: 1
Network: mainnet
Nonce: PYxxb9msdjVXsMQ9x
Issued At: 2022-08-25T11:02:34.097Z
Expiration Time: 2022-08-25T11:12:38.243Z
Resources:
- https://docs.moralis.io/",
"signature": "2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny"
}
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 Solana account:\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\n\nI am a third party API\n\nURI: http://defi.finance\nVersion: 1\nNetwork: mainnet\nNonce: PYxxb9msdjVXsMQ9x\nIssued At: 2022-08-25T11:02:34.097Z\nExpiration Time: 2022-08-25T11:12:38.243Z\nResources:\n- https://docs.moralis.io/',
signature: '2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny'
})
};
fetch('https://authapi.moralis.io/challenge/verify/solana', 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/solana",
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 Solana account:
26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo
I am a third party API
URI: http://defi.finance
Version: 1
Network: mainnet
Nonce: PYxxb9msdjVXsMQ9x
Issued At: 2022-08-25T11:02:34.097Z
Expiration Time: 2022-08-25T11:12:38.243Z
Resources:
- https://docs.moralis.io/',
'signature' => '2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny'
]),
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/solana"
payload := strings.NewReader("{\n \"message\": \"defi.finance wants you to sign in with your Solana account:\\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\\n\\nI am a third party API\\n\\nURI: http://defi.finance\\nVersion: 1\\nNetwork: mainnet\\nNonce: PYxxb9msdjVXsMQ9x\\nIssued At: 2022-08-25T11:02:34.097Z\\nExpiration Time: 2022-08-25T11:12:38.243Z\\nResources:\\n- https://docs.moralis.io/\",\n \"signature\": \"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny\"\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/solana")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"defi.finance wants you to sign in with your Solana account:\\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\\n\\nI am a third party API\\n\\nURI: http://defi.finance\\nVersion: 1\\nNetwork: mainnet\\nNonce: PYxxb9msdjVXsMQ9x\\nIssued At: 2022-08-25T11:02:34.097Z\\nExpiration Time: 2022-08-25T11:12:38.243Z\\nResources:\\n- https://docs.moralis.io/\",\n \"signature\": \"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://authapi.moralis.io/challenge/verify/solana")
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 Solana account:\\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\\n\\nI am a third party API\\n\\nURI: http://defi.finance\\nVersion: 1\\nNetwork: mainnet\\nNonce: PYxxb9msdjVXsMQ9x\\nIssued At: 2022-08-25T11:02:34.097Z\\nExpiration Time: 2022-08-25T11:12:38.243Z\\nResources:\\n- https://docs.moralis.io/\",\n \"signature\": \"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny\"\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": "26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo",
"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 Solana challenge message.
Message that needs to be signed by the end user
"defi.finance wants you to sign in with your Solana account:\n26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\n\nI am a third party API\n\nURI: http://defi.finance\nVersion: 1\nNetwork: mainnet\nNonce: PYxxb9msdjVXsMQ9x\nIssued At: 2022-08-25T11:02:34.097Z\nExpiration Time: 2022-08-25T11:12:38.243Z\nResources:\n- https://docs.moralis.io/"
Base58 signature that needs to be used to verify end user
"2pH9DqD5rve2qV4yBDshcAjWd2y8TqMx8BPb7f3KoNnuLEhE5JwjruYi4jaFaD4HN6wriLz2Vdr32kRBAJmHcyny"
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, devnet "mainnet"
Solana address with a length of 32 - 44 characters that is used to perform the signing
"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo"
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/"]

