I am trying to authenticate a user using the Basic Authentication protocol in Jquery but it keeps giving error:"XMLHttpRequest cannot load https://api.credly.com/v1.1/authenticate. Request header field authorization is not allowed by Access-Control-Allow-Headers."
But when I check the API using postman client, it works fine.
Jquery Code:
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.credly.com/v1.1/authenticate",
"method": "POST",
"headers": {
"x-api-key": "myAPIkey",
"x-api-secret": "mySECRET",
"authorization": "Basic "+btoa(<email> + ":" + <password>)
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
the API is working for POSTMAN client so there should be no issue in that but it is not working in Jquery. Please help.