title: angularjs - $resource cookie phpsessid changes every server request
body: <p>I use $resource to login to a (Yii) php backend. After the login I want to retreive all cars (for example). BUT the received cookie, contains a different PHPSESSID every request. How can this problem be fixed? (it works when I use a RESTclient (browser addon), but not in angularJs)</p>
  
  <p>An usecase: (login + get all cars)</p>
  
  <p>[LOGIN]:</p>
  
  <p><code>
  $var user = $resource(conf.HOST+'/user/login',{},{'login':{method:'POST',isArray: false}});    user.login({username:username,password:password}).$promise.then(function(resp,head){ // GOES WELL};
  </code></p>
  
  <p><strong>we should be authenticated now</strong></p>
  
  <p>The server response cookie contains TWO received PHPSESSID's lets say <strong>A &amp; B</strong></p>
  
  <p>[GET CARS]:</p>
  
  <p><code>  var client = $resource(conf.HOST+'/api/client',{},{'all':{method:'GET',isArray:false}});
    var clients = client.all();</code></p>
  
  <p>The server response cookie contains ONE received PHPSESSID's lets say <strong>C</strong>
  if i invoke the client.all() function again, the received PHPSESSID changes again to lets say D.</p>
  
  <p><strong>How can this problem (changing sessionId over requests) be fixed?</strong></p>