How to get $ _SESSION value in cakephp

I am setting up a user session from the main php application located at example.com/corephp/ , now I want to redirect this user to example.com (main site) located in cakephp.

How to save user session from main php application to cakephp application?

I install $_SESSION['user'] = someoneboth $_SESSION['token'] = tokenfrom the main php application and try to extract this value from cakephp, but this did not work.

I tried to use Google for this, but could not answer the correct answer.

Thanks in advance.

---------------------- edit

I tried adding session_name ('CAKEPHP'); to the main php application. And also tried to lower the security level of my cake application from medium to low.

+5
source share
2 answers

Not tested, but try this.

In your corephp application:

$_SESSION['Auth']['User'] = $someone;

My reasoning is that it will install $ _SESSION, but CakePHP may not recognize it for some reason. Therefore, we installed it correctly using the Cake API:

In CakePHP

$this->Session->write('Auth.User', $_SESSION['Auth']['User']);
+2
source

All Articles