I'm also unable to access response cookies. I can see the cookie in the Chrome dev console.
I'm using Express as my backend and this is the snippet of code I'm using to set the cookie on the response:
res.cookie('test', 'test', { expires: new Date(Date.now() + 900000), httpOnly: false });
return res.send(data);
And here is my service:
authModule.factory('authenticationService', ['$cookies', '$http', function ($cookies, $http) {
var AuthService = {
login: function (email, password) {
var config = {
method: 'POST',
data: {
email: email,
password: password
}
};
//TODO: Implement some better non 200 status code handling
var promise = $http(config).then(function (response) {
console.log($cookies.test);
console.log(response.headers('Set-Cookie'));
console.log(response.headers());
var status = response.status;
switch (status) {
case 200:
return response.data;
break;
};
});
return promise;
}
The console shows:
Object {content-type: "application/json; charset=utf-8"}
Anyone know what they heck is going on? I'm also surprised I can't see more header values.
Thanks for the help!
On Friday, April 27, 2012 4:09:22 AM UTC-7, Stas Sarosek wrote: