Search code examples
phpsymfonysessionsymfony-3.4

How to change phpsessid after login using symfony 3.4


I'd like to use different session id (PHPSESSID value) before and after login to the system:

$this->get("session")->set("PHPSESSID", session_create_id());

but after doing that cannot log onto system.

I found a solution here but I don't have security.xml file: Symfony 3 - How to keep session id after logging in?

Any solutions will be appreciated.


Solution

  • You can use

    $this->get("session")->migrate();
    

    It should create a new session identical to the current session.

    More info here http://symfony.com/doc/3.4/components/http_foundation/sessions.html