after these changes Use logout_path() helper + add CSRF protection to logout change password is not working , Invalid CSRF token. in UserController return $this->redirectToRoute('security_logout');