I am attempting to GET information from an AWS server using AngularJS. In order to communicate with the server, an "authorization" is required in the header. I am able to accomplish this with Node.js using 'request', but the AngularJS approach fails.
Note that I had to hide the server address and the authorization for obvious reasons.
The failure occurs somewhere in the '$http.GET' portion. The $scope.message value is set and appears correctly, however, the alert() is never called. I have tried several iterations with passing the information as a config string, etc... I have also tried another website outside the network (but it does not have any authorization requirements), and it works.
Any ideas? Anyone else have any issues talking to AWS server with authorization when using AngularJS?
Here is the code:
var myApp = angular.module('displayApp', [])
myApp.controller('httpController', ['$scope', '$http', function($scope, $http){
$scope.message = "HTTP Testing"
$http({method: 'GET', url: 'http://xxxxxxxxxxxxx.compute-1.amazonaws.com/', headers:{authorization: 'xxxxxxx:xxxxxxxuqu+0gTv'}})
.then(function(response){
alert("Made it through!!");
});
}]);