How to force user logout symfony2 How to force user logout symfony2 wordpress wordpress

How to force user logout symfony2


You can force logout by calling setToken() with null, try something like this:

$this->container->get('security.context')->setToken(null);

It will destroy user token from the security context and kick the user out.


Also, please see this question for more details: Symfony2: how to log user out manually in controller?