Skip to main content
Version: 2.2

Request Aptos challenge

POSThttps://authapi.moralis.io/challenge/request/aptos
BODY PARAM
domainstringrequired
RFC 4501 dns authority that is requesting the signing.
statementstring

Human-readable ASCII assertion that the user will sign, and it must not contain .

uristringrequired
RFC 3986 URI referring to the resource that is the subject of the signing (as in the subject of a claim).
expirationTimestring
ISO 8601 datetime string that, if present, indicates when the signed authentication message is no longer valid.
notBeforestring
ISO 8601 datetime string that, if present, indicates when the signed authentication message will become valid.
resourcesarray
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 new lines.
timeoutnumberrequired
Time in seconds before the challenge is expired
chainIdstringrequired
Chain ID to which the session is bound, and the network where Contract Accounts must be resolved.
addressstringrequired
Aptos address performing the signing conformant.
publicKeystringrequired
Aptos public key performing the signing conformant.
Responses
API KEY
// Dependencies to install:
// $ npm install node-fetch --save
// add "type": "module" to package.json

import fetch from 'node-fetch';

const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
"domain": "defi.finance",
"statement": "Please confirm",
"uri": "https://defi.finance/",
"expirationTime": "2020-01-01T00:00:00.000Z",
"notBefore": "2020-01-01T00:00:00.000Z",
"timeout": 15,
"chainId": 1,
"address": "0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d",
"publicKey": "0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d"
})
};

fetch('https://authapi.moralis.io/challenge/request/aptos', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
{
"id": "fRyt67D3eRss3RrXa",
"profileId": "0xbfbcfab169c67072ff418133124480fea02175f1402aaa497daa4fd09026b0e1",
"message": "defi.finance wants you to sign in with your Aptos account:\n0xfb2853744bb8afd58d9386d1856afd8e08de135019961dfa3a10d8c9bf83b99d\n\nPlease confirm\n\nURI: https://defi.finance/\nVersion: 1\nChain ID: 1\nNonce: DbU1DCTmdzR4lg3wi\nIssued At: 2022-06-12T12:15:31.290Z\nExpiration Time: 2020-01-01T00:00:00.000Z\nNot Before: 2020-01-01T00:00:00.000Z\nResources:\n- https://docs.moralis.io/"
}