Im having trouble with the angular $http.get request and header parameter. Im trying to replicate this cURL
curl -X GET --header "Accept: application/json" --header "authenticationkey: somerandomtoken" "http://external.domain.com/admin/"
Which gives me the response I want.
In angular:
var urlBase = "//external.domain.com/admin/";
var config = {
headers:{
'Accept' : 'application/json',
'authenticationkey': 'somerandomtoken'
}
};
dataFactory.getToken = function () {
return $http.get(urlBase,config);
};
And I get this error message:
XMLHttpRequest cannot load http://external.domain.com/admin/. Request header field authenticationkey is not allowed by Access-Control-Allow-Headers in preflight response.
This is driving me insane. Also tried this, AngularJS $http custom header for all requests and it gives me the same error. Any ideas?