I'm using deployd for simulation of http requests. I want to authenticate with my credentials to the database.
This is my controller code
.controller("authCtrl", function($scope, $http, $location, authUrl) {
$scope.authenticate = function (user, pass) {
$http.post(authUrl, {
username: user,
password: pass
}).success(function (data) {
console.log(data);
$location.path("main");
}).error(function (error) {
console.log("error");
$scope.authenticationError = error;
});
}
})
I get following message after entering one of credentials wrong.
Object { message: "bad credentials", status: 401 }
and I get following message after entering two credentials correctly.
Object { path: "/users", id: "11a58ccdcc31c9b863b7a5e63d9d672fdae…", uid: "e2ad770f0847f8ac" }
My problem is not to get "error" log. Only success event is being fired. Entering credentials wrong or right does not change the situation.