Question

Before talking about my issue I will shortly describe the project I am working on.

On one hand I am wokring on an API (based on symfony 2.x). This API is (will be) used by a website and smartphone apps and will handle all the requests that I need to do on my database.

On the other hand I am developing a website (also based on symfony 2.x). Within this website I am using curl to do the requests on the API.

I am sending a curl request to login and another one just after to get some data (I need to be logged in to get that data). I am keeping the same handler for all my requests (so the connection to the API is normally not lost).

So, the problem is that after I've logged in, the second request I sent I'm getting an error saying that I need to be logged in to do that. After research I found out that the sessions are different (different session id's) for each of the requests so naturally all information about the logged user is lost.

I was thinking that as the connection isn't closed between those two requests the session should have been the same.

Do you guys have any idea of why this is happening ?

Thank you for your help,

Was it helpful?

Solution 2

Problem solved.

I found out that the API wasn't setting the PHPSESSID cookie in the response header.

Anyway, thank you for your help

OTHER TIPS

TODO

  • be sure to have session_start();
  • check whether $_SESSION array is
  • not overwritten somehow you must redirect to the same domain. check
  • session_save_path and permissions on it
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top