Hi … I followed the tutorial steps on how to get the Auth component working,
but its not… any idea why ?? see my code.
The error is that after logged in… the next controller (NotasController) redirects me once again to the login page… and i can see that
this line
$user = $this->Auth->user();
user is allways null. on NotasController
see the code here… for more information…
pastebin.com/1jSLR18G
Thank you…
ADmad
June 26, 2016, 7:41am
2
By default the authentication process is done after beforeFilter()
callbacks of controller are run. If you want logged in user info to be available in beforeFilter()
set 'checkAuthIn' => 'Controller.initialize'
in AuthComponent
config.
Sorry I tried that,
$this->Auth->config(‘checkAuthIn’, ‘Controller.initialize’);
in the AppController initialize() function.
and still not working… it redirects me to the login page… without passing the before filter… on NotasController.
It Seems that the session is lost after redirecting to next controller…
i’m feeling frustrated…
Any other idea ??
Thanks for your soon response…
I just solved this by setting my Session config like this…
‘Session’ => [
‘defaults’ => ‘php’,
/* ‘handler’ => [
‘config’ => ‘session’
],*/
‘timeout’ => 1440,
‘ini’ => [
‘session.cookie_secure’ => false, //<---- this
’session.cookie_lifetime’ => 1440, //<— this
’session.cookie_path’ => ‘/’, //<—this
’session.cookie_domain’ => ‘localhost’ //<— this
]
],
It works on my localhost pc, and I hope it works the same on web hosting…
Thank you…