Getting 401 while making a GET request


#1

I am trying to make a GET request to my dreamfactory endpoint. But, I am getting the 401 code while doing so from my angular app. But the request was made successfully when I made it from Postman.
Here’s the snippet:

var header = {headers:  {
    "X-DreamFactory-Application-Name" : "myApp",

}};

$scope.doLogin = function (){
				$scope.login = $stateParams.login;
				$http.get('https://some-url.cloud.dreamfactory.com:443/rest/db/myapp', header).success(function ( response ) {
					$scope.logins = response.record;
					//console.log($scope.logins);
				});
				$scope.goHome = function () {
					$state.go('app.home');
				};
			}

Where Am I going wrong?


#2

Anyways, I solved it by enabling CORS and Guest Login from the system panel. Thanks :smile:


#3

Good to hear you got it working, @liveashish. Please also take a look at our wiki for configuration options.

https://github.com/dreamfactorysoftware/dsp-core/wiki/CORs-Configuration