I really did all the best trying to resolve this issue with no avail. All similar questions on SO don't seem easy for me to understand. User get logged out after one page refresh, sometimes after two...there is no logic in this behaviour.
I am not familiar to log files, it is the first time I am reading them and I hope I am giving you the appropriate lines among the hundreds. By the way, these lines are about some internal Symfony stuff that I still don't get:
[2015-10-18 20:48:18] request.INFO: Matched route "user_admin_page" (parameters:"_controller": "Members\Bundle\ManagementBundle\Controller\AdminController::indexAction", "_route": "user_admin_page") [] []
.......
[2015-10-18 20:48:18] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] [] [2015-10-18 20:48:19] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2015-10-18 20:48:19] event.DEBUG: Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException". [] []
[2015-10-18 20:48:19] security.DEBUG: Access is denied (user is not fully authenticated) by "C:\xampp\htdocs\community\vendor\symfony\symfony\src\Symfony\Component\Security\Http\Firewall\AccessListener.php" at line 70; redirecting to authentication entry point [] []
[2015-10-18 20:48:19] security.DEBUG: Calling Authentication entry point [] []
[2015-10-18 20:48:19] event.DEBUG: Listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException" stopped propagation of the event "kernel.exception". [] []
......
[2015-10-18 20:48:19] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\Security\Http\Firewall\ContextListener::onKernelResponse". [] []
[2015-10-18 20:48:19] security.DEBUG: Write SecurityContext in the session [] []
Your help is much appreciated.
session_start()on every page load... It's not enough to call session_start and set a session variable when your user logs in. To refer to that session variable in future pages you first need to start the session again on each page. Better say on each php file loaded. - Julio Soaressession_start()somewhere, I only configured some security in security.yml, and did the minimal configuration of FOSUserBundle. In my small understanding, I was abstracted from such raw basic functions! - Adib Arouisession_php native functions but replace them with similar but enhanced ones. that's why I didn't recognize it when you mentionned it yesterday. Other thing regarding my issue is the line:security.INFO: Populated SecurityContext with an anonymous Token, when googled with these keywords, I found many related posts on SO which hopefully will help. I'll Be back - Adib Aroui