{"action":"opened","issue":{"url":"https://api.github.com/repos/escapestudios/EscapeWSSEAuthenticationBundle/issues/70","labels_url":"https://api.github.com/repos/escapestudios/EscapeWSSEAuthenticationBundle/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/escapestudios/EscapeWSSEAuthenticationBundle/issues/70/comments","events_url":"https://api.github.com/repos/escapestudios/EscapeWSSEAuthenticationBundle/issues/70/events","html_url":"https://github.com/escapestudios/EscapeWSSEAuthenticationBundle/issues/70","id":94108838,"number":70,"title":"Use twig to render 401 template?","user":{"login":"bkosborne","id":544886,"avatar_url":"https://avatars.githubusercontent.com/u/544886?v=3","gravatar_id":"","url":"https://api.github.com/users/bkosborne","html_url":"https://github.com/bkosborne","followers_url":"https://api.github.com/users/bkosborne/followers","following_url":"https://api.github.com/users/bkosborne/following{/other_user}","gists_url":"https://api.github.com/users/bkosborne/gists{/gist_id}","starred_url":"https://api.github.com/users/bkosborne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkosborne/subscriptions","organizations_url":"https://api.github.com/users/bkosborne/orgs","repos_url":"https://api.github.com/users/bkosborne/repos","events_url":"https://api.github.com/users/bkosborne/events{/privacy}","received_events_url":"https://api.github.com/users/bkosborne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-09T17:34:14Z","updated_at":"2015-07-09T17:34:14Z","closed_at":null,"body":"I'm trying to use a unified response body for any 4xx or 5xx errors in an API that uses this bundle for authentication. Something like this:\r\n\r\n```\r\n{\r\n  \"error\": {\r\n    \"http_status_code\": 401,\r\n    \"message\": \"Unauthorized\"\r\n  }\r\n}\r\n```\r\n\r\nWhen there is an authentication error (like a malformed WSSE header or incorrect header), then this bundle just returns a basic response with the code set to 401 and some WSSE authenticate headers.\r\n\r\nI've been looking thru the Security component trying to figure out how all this works - It looks normally when there's an AuthenticationException, the user is typically redirected to some failure page (or the login page) and a message is saved to the session explaining the error.\r\n\r\nSo I'm not sure in any normal circumstance Symfony actually returns a 401 page and template.\r\n\r\nHas anyone been able to get a template for 401s?"}}