Reputation: 189
I am working on login application.
For that, I am calling a backend service which is a post call. It returns a cookie. Inside cookie, there is a token. I need that token.
I am trying to get that token, but it is coming null when I try to access in using $cookie.get method.
Can anyone suggest me what could be the possible reason?
Here is the code:
$http({
url:"http://10.11.0.11:4440/j_security_check",
method:"POST",
data:data,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(function successCallback(response) {
console.log("Login Success!!");
console.log( "cookie ", response.headers('Set-Cookie') ); //Returning NULL
console.log("cookies"+$cookies.get('JSESSIONID')); //Returning undefined
$location.url("/report");
}, function errorCallback() {
$scope.loginError = "Invalid username/password combination.";
$scope.result = 'error';
console.log('Login failed');
});
Here is the snap of response which I am getting in my browser's network tool:
Upvotes: 0
Views: 59