title: angularjs basic authentication headers
body: <p>I'm trying to connect to API and send authentication headers. 
  I'm using Base64 as described here <a href="https://stackoverflow.com/questions/17959563/how-do-i-get-basic-auth-working-in-angularjs">How do I get basic auth working in angularjs?</a></p>
  
  <pre><code>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);
          });
  }
  </code></pre>
  
  <p>but i'm getting this error </p>
  
  <p>XMLHttpRequest cannot load <a href="https://.../Category.json?callback=" rel="nofollow noreferrer">https://.../Category.json?callback=</a>?. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://....com" rel="nofollow noreferrer">http://....com</a>' is therefore not allowed access. The response had HTTP status code 400.</p>