namespace AppControllerSecurityController;
use SymfonyBundleSecurityBundleSecurity;
use SymfonyComponentRoutingAttributeRoute;
class SecurityController
{
#[Route(path: '/logout', name: 'logout')]
public function someAction(Security $security): Response
{
$response = $security->logout();
return $this->redirectToRoute('login');
}
}
Twig
<a href="{{ path('logout', {'token' : csrf_token('logout')}) }}">
I get it from documentation Symfony 6.4 but faced with error “Unable to logout with CSRF token validation. ”
what wrong ? I don`t want disable csrf protection
1