This is my first time using the Django Framework. The service provider I am working with requires an active Cookie to access data on their API Docs.
We recently obtained an API Token that we need to use to fetch the data from the framework.
Despite trying to make the data call with the Token through AJAX, I keep getting the same error message "401 (Unauthorized)" in the console.
$.ajax({
type: 'POST',
headers: {
'X-CSRFTOKEN': "XXXXXXXXXXXXXXX",
'Content-Type': 'application/json'
},
url: 'www.service-provider.url/api/...',
success: function () {
console.log("ok");
},
error: function () {
console.log("error");
}
});
I'm still very new at this and not sure where to even begin. I've looked online for solutions but haven't found anything that solves the issue.