AngularJS $http and cookies

I'm trying to implement authentication with ExpressJS' cookie sessions and AngularJS. The problem is that even I can get ExpressJS to send session cookies, Angular won't send them with subsequent requests.

I'm running backend server at 192.168.1.2:3000 and yeoman server at 192.168.1.2:3501 so is there a cross-domain issue here? I already did the normal CORS stuff with ExpressJS in order to get $http working correctly but I'm not sure how to get the cookies working.

Have you checked that your request is sent with the withCredentialsflag set to true?

In angular, this can be done by in the HTTP request configuration object, e.g

//...
$http.get(myUrl, {withCredentials: true})
//...

Or if you don't want to reconfigure it all the time, using $httpProvider:

myApp.config(['$httpProvider', function ($httpProvider) {
  $httpProvider.defaults.withCredentials = true;
}]);

to get cookies working in angularJS you could follow this link

I maintain session variable in the backend (expressJS) and return it to the $cookies object in the frontend(angularJS).

So When i logout, it would delete the cookie in angularJS and the session variable in the backend.