Angularjs - $ resource cookie phpsessid change every server request

I am using $ resource to login to (Yii) php server. After logging in, I want, for example, to return all cars. BUT the cookie received contains a different PHPSESSID for each request. How can this problem be resolved? (it works when i use RESTclient (browser addon) but not in angularJs)

User: (login + get all cars)

[ENTRANCE]:

$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};

we must authenticate

Server response cookies contain two received PHPSESSIDs that allow A and B to speak

[GET CARS]:

var client = $resource(conf.HOST+'/api/client',{},{'all':{method:'GET',isArray:false}}); var clients = client.all();

The server response cookie contains ONE received PHPSESSID lets say C if I call client.all () again, the received PHPSESSID changes again to tell D.

How can I fix this problem (change sessionId over requests)?

+3


source to share





All Articles