I am trying to connect to the API and send authentication headers. I am using Base64 as described here How can I get basic auth working in angularjs?
function Cntrl($scope, $http, Base64) { $http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode('----myusername----' + ':' + '----mypass---'); $http({method: 'GET', url: 'https://.../Category.json'}). success(function(data, status, headers, config) { console.log('success'); }). error(function(data, status, headers, config) { alert(data); }); }
but i get this error
XMLHttpRequest cannot load https: //.../Category.json? Callback = ?. The requested resource does not have an Access-Control-Allow-Origin header. The origin of http: //....com 'is therefore not allowed. The response was an HTTP 400 status code.
mrshickle
source share