So I am trying to get data from a third-party API. It works on postman but I want to make a request and get the data from my to react project.
Here is the public API: https://api.securityscorecard.io/companies/okta.com where I can grab data about okta.com. and the token is Token Qit1XE1nrE1NHYfIkzHH8MGxUwUO.
It works fine on the postman. Take a look at the screenshot below.
How can I make a valid request to get this data in react? Here is what I tried so far.
axios({
url: "https://api.securityscorecard.io/companies/okta.com",
method: "get",
headers: {
Token: "Qit1XE1nrE1NHYfIkzHH8MGxUwUO",
},
})
.then((response) => {
console.log("okta data", response);
})
.catch((err) => {
console.log(err);
});
But It did not work. Where is my mistake here? Thanks
try this:
axios({
url: "https://api.securityscorecard.io/companies/okta.com",
method: "get",
headers: {
Authorization: "Token Qit1XE1nrE1NHYfIkzHH8MGxUwUO",
},
})
.then((response) => {
console.log("okta data", response);
})
.catch((err) => {
console.log(err);
});