I wrote the following controller for testing out HTTP Basic Auth using Angular JS.
function TestCtrl($scope, $http, Base64){
$http.defaults.headers.common.Authorization = 'Basic ' + Base64.encode('admin:secret');
$http.jsonp( 'http://localhost:5000/test'+'/?callback=JSON_CALLBACK', {query:{isArray:true }}).
then(function (response) {
$scope.test = response.data;
});
}
I can see the header being set when i console.log($http.defaults.headers)
. But when i check the request headers using Chrome Developer Toolbar or Firebug in Firefox, i don't see the Authorization header.
The server receiving the request doesn't get the Authorization header.
What i am doing wrong here ?