Authentication Headers to access server side API by using tokens


#1

I am new to the software industry and have been given a task to to develop an app which will be presenting API in JSON. I used enterprise´s credentials to access the API and was able to list the JSON values in POSTMAN.

Now I am facing problem to implement the same in my browser´s console. I tried the simple http request with the below code.

var app = angular.module(‘starter’, [‘ionic’])

var token = API_TOKEN

app.controller(SeventhApiCtrl, function($http, $scope){

$scope.stories = [];

$http.get(http://******)
headers:{

‘Authorization’: ‘Bearer’ + token,
‘Content-Type’: ‘application/json; charset=utf-8’
}

.success(function(response){
console.log(response);
});

});

But not able to display the object values. Is my header is wrong?