Hi folks, could i get some help with the Moralis V2 Auth API request-message API call. When i call the emdpoint i get a request failed with status code 400 message. Please see below for full error message i have removed the wallet address on purpose:
Some help would be this would be great.
POST /request-message 400 0.800 ms - 44
MoralisError [Moralis SDK Core Error]: [C0006] Request failed, Bad Request(400): Unauthorized
at RequestController.makeError (/Users/davidjamison/lettsart/lettsartblockchain/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:119:20)
at RequestController. (/Users/davidjamison/lettsart/lettsartblockchain/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:100:38)
at step (/Users/davidjamison/lettsart/lettsartblockchain/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:44:23)
at Object.throw (/Users/davidjamison/lettsart/lettsartblockchain/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:25:53)
at rejected (/Users/davidjamison/lettsart/lettsartblockchain/node_modules/@moralisweb3/core/lib/controllers/RequestController/RequestController.js:17:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
isMoralisError: true,
code: âC0006â,
details: {
status: 400,
response: {
status: 400,
statusText: âBad Requestâ,
headers: [Object],
config: [Object],
request: [ClientRequest],
data: [Object]
}
},
[cause]: [AxiosError: Request failed with status code 400] {
code: âERR_BAD_REQUESTâ,
config: {
transitional: [Object],
adapter: [Function: httpAdapter],
transformRequest: [Array],
transformResponse: [Array],
timeout: 10000,
xsrfCookieName: âXSRF-TOKENâ,
xsrfHeaderName: âX-XSRF-TOKENâ,
maxContentLength: -1,
maxBodyLength: -1,
env: [Object],
validateStatus: [Function: validateStatus],
headers: [Object],
url: âhttps://authapi.moralis.io/challenge/request/evmâ,
params: {},
method: âpostâ,
data: â{âchainIdâ:â0x1â,âaddressâ:âDIDNTWANTTOPOSTWALLETADDRESSâ,âdomainâ:âapp.lettsartâ,âstatementâ:âPlease sign this message to confirm your identity.â,âuriâ:âhttp://localhost:4200/","timeoutâ:60}â
},
request: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: ââ,
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: âPOST /challenge/request/evm HTTP/1.1\r\nâ +
âAccept: application/json, text/plain, /\r\nâ +
âContent-Type: application/json\r\nâ +
âx-moralis-platform: JS SDK\r\nâ +
âx-moralis-platform-version: 2.7.4\r\nâ +
âx-moralis-build-target: node\r\nâ +
âx-api-key: F\r\nâ +
âUser-Agent: axios/0.27.2\r\nâ +
âContent-Length: 205\r\nâ +
âHost: authapi.moralis.io\r\nâ +
âConnection: close\r\nâ +
â\r\nâ,
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: âPOSTâ,
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: â/challenge/request/evmâ,
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: âauthapi.moralis.ioâ,
protocol: âhttps:â,
_redirectable: [Writable],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(kUniqueHeaders)]: null
},
response: {
status: 400,
statusText: âBad Requestâ,
headers: [Object],
config: [Object],
request: [ClientRequest],
data: [Object]
}
}
}