Hi, when I try deep index allowance it returns Error:
Response body
Download
"JWT missing"
Response headers
content-length: 13 content-type: application/json; charset=utf-8
what Im missing?
Hi, when I try deep index allowance it returns Error:
Download
"JWT missing"
content-length: 13 content-type: application/json; charset=utf-8
what Im missing?
Hi @legenuspl,
You would require to generate a JWT token for authorisation when you make calls to the Deep index API.
Please run the api call -
For more information, please check out the docs over here – https://docs.moralis.io/deep-index-rest-api/deep-index-api
Hope this helps.
Do let me know if there’s anything else.
How to pass json file i received from account/generateToken?
Hi @legenuspl
If you want to make calls using the interactive documentation, press the “Authorize” button at the top of the page, paste the JWT token you received from Generate token response
in the “value” input and confirm by pressing “Authorize”.
From Cloud Functions:
Moralis.Cloud.httpRequest({
method: "POST",
headers: { accept: "*/*" },
url: "https://xxxxxx.moralis.io:2053/api/account/generateToken?key=yourmasterkey",
body: "",
})
.then(function (httpResponse) {
const data = httpResponse.data;
return data;
})
.then((data) => {
const tokenJWT = `Bearer ${data}`;
return Moralis.Cloud.httpRequest({
method: "POST",
mode: "cors",
url: "yourUrl",
headers: {
"Access-Control-Allow-Origin": true,
Authorization: tokenJWT,
accept: "application/json",
"Content-Type": "application/json",
},
body: yourBody,
}).then(function (httpResponse) {
console.log(httpResponse);
});
});
fetch("https://xxxxxx.moralis.io:2053/api/account/generateToken?key=yourmasterkey", {
method: "POST",
headers: { accept: "*/*" },
body: "",
})
.then(function (httpResponse) {
const data = httpResponse.data;
return data;
})
.then((data) => {
const tokenJWT = `Bearer ${data}`;
fetch(yourUrl, {
method: "POST",
mode: "cors",
headers: {
"Access-Control-Allow-Origin": true,
Authorization: tokenJWT,
accept: "application/json",
"Content-Type": "application/json",
},
body: yourBody,
}).then(function (httpResponse) {
console.log(httpResponse);
});
});
Request URLs you can get in the interactive documentation.
Hope this helps