Request Solana challenge
curl --request POST \
--url https://authapi.moralis.io/challenge/request/solana \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"domain": "defi.finance",
"uri": "https://defi.finance/",
"timeout": 15,
"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/"
]
}
'import requests
url = "https://authapi.moralis.io/challenge/request/solana"
payload = {
"domain": "defi.finance",
"uri": "https://defi.finance/",
"timeout": 15,
"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/"]
}
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({
domain: 'defi.finance',
uri: 'https://defi.finance/',
timeout: 15,
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/']
})
};
fetch('https://authapi.moralis.io/challenge/request/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/request/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([
'domain' => 'defi.finance',
'uri' => 'https://defi.finance/',
'timeout' => 15,
'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/'
]
]),
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/request/solana"
payload := strings.NewReader("{\n \"domain\": \"defi.finance\",\n \"uri\": \"https://defi.finance/\",\n \"timeout\": 15,\n \"network\": \"mainnet\",\n \"address\": \"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\",\n \"statement\": \"Please confirm\",\n \"expirationTime\": \"2020-01-01T00:00:00.000Z\",\n \"notBefore\": \"2020-01-01T00:00:00.000Z\",\n \"resources\": [\n \"https://docs.moralis.io/\"\n ]\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/request/solana")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"defi.finance\",\n \"uri\": \"https://defi.finance/\",\n \"timeout\": 15,\n \"network\": \"mainnet\",\n \"address\": \"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\",\n \"statement\": \"Please confirm\",\n \"expirationTime\": \"2020-01-01T00:00:00.000Z\",\n \"notBefore\": \"2020-01-01T00:00:00.000Z\",\n \"resources\": [\n \"https://docs.moralis.io/\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://authapi.moralis.io/challenge/request/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 \"domain\": \"defi.finance\",\n \"uri\": \"https://defi.finance/\",\n \"timeout\": 15,\n \"network\": \"mainnet\",\n \"address\": \"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\",\n \"statement\": \"Please confirm\",\n \"expirationTime\": \"2020-01-01T00:00:00.000Z\",\n \"notBefore\": \"2020-01-01T00:00:00.000Z\",\n \"resources\": [\n \"https://docs.moralis.io/\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "fRyt67D3eRss3RrXa",
"profileId": "0xbfbcfab169c67072ff418133124480fea02175f1402aaa497daa4fd09026b0e1",
"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/"
}Challenge
Request Solana challenge
POST
/
challenge
/
request
/
solana
Request Solana challenge
curl --request POST \
--url https://authapi.moralis.io/challenge/request/solana \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"domain": "defi.finance",
"uri": "https://defi.finance/",
"timeout": 15,
"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/"
]
}
'import requests
url = "https://authapi.moralis.io/challenge/request/solana"
payload = {
"domain": "defi.finance",
"uri": "https://defi.finance/",
"timeout": 15,
"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/"]
}
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({
domain: 'defi.finance',
uri: 'https://defi.finance/',
timeout: 15,
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/']
})
};
fetch('https://authapi.moralis.io/challenge/request/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/request/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([
'domain' => 'defi.finance',
'uri' => 'https://defi.finance/',
'timeout' => 15,
'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/'
]
]),
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/request/solana"
payload := strings.NewReader("{\n \"domain\": \"defi.finance\",\n \"uri\": \"https://defi.finance/\",\n \"timeout\": 15,\n \"network\": \"mainnet\",\n \"address\": \"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\",\n \"statement\": \"Please confirm\",\n \"expirationTime\": \"2020-01-01T00:00:00.000Z\",\n \"notBefore\": \"2020-01-01T00:00:00.000Z\",\n \"resources\": [\n \"https://docs.moralis.io/\"\n ]\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/request/solana")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"defi.finance\",\n \"uri\": \"https://defi.finance/\",\n \"timeout\": 15,\n \"network\": \"mainnet\",\n \"address\": \"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\",\n \"statement\": \"Please confirm\",\n \"expirationTime\": \"2020-01-01T00:00:00.000Z\",\n \"notBefore\": \"2020-01-01T00:00:00.000Z\",\n \"resources\": [\n \"https://docs.moralis.io/\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://authapi.moralis.io/challenge/request/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 \"domain\": \"defi.finance\",\n \"uri\": \"https://defi.finance/\",\n \"timeout\": 15,\n \"network\": \"mainnet\",\n \"address\": \"26qv4GCcx98RihuK3c4T6ozB3J7L6VwCuFVc7Ta2A3Uo\",\n \"statement\": \"Please confirm\",\n \"expirationTime\": \"2020-01-01T00:00:00.000Z\",\n \"notBefore\": \"2020-01-01T00:00:00.000Z\",\n \"resources\": [\n \"https://docs.moralis.io/\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "fRyt67D3eRss3RrXa",
"profileId": "0xbfbcfab169c67072ff418133124480fea02175f1402aaa497daa4fd09026b0e1",
"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/"
}Body
application/json
Request Solana challenge message.
Response
201 - application/json
The back channel challenge containing the id to store on the api and the message to be signed by the user
Message that needs to be signed by the end user
Example:
"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/"

