{"action":"closed","issue":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/664","labels_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/664/labels{/name}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/664/comments","events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/664/events","html_url":"https://github.com/doorkeeper-gem/doorkeeper/issues/664","id":78813071,"number":664,"title":"Feature Request: Display Built-In Unauthorized ","user":{"login":"edmondchui","id":1108393,"avatar_url":"https://avatars.githubusercontent.com/u/1108393?v=3","gravatar_id":"","url":"https://api.github.com/users/edmondchui","html_url":"https://github.com/edmondchui","followers_url":"https://api.github.com/users/edmondchui/followers","following_url":"https://api.github.com/users/edmondchui/following{/other_user}","gists_url":"https://api.github.com/users/edmondchui/gists{/gist_id}","starred_url":"https://api.github.com/users/edmondchui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edmondchui/subscriptions","organizations_url":"https://api.github.com/users/edmondchui/orgs","repos_url":"https://api.github.com/users/edmondchui/repos","events_url":"https://api.github.com/users/edmondchui/events{/privacy}","received_events_url":"https://api.github.com/users/edmondchui/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-21T03:51:43Z","updated_at":"2015-05-24T15:39:06Z","closed_at":"2015-05-24T15:39:06Z","body":"Per the wiki page [Customizing the response body when unauthorized](https://github.com/doorkeeper-gem/doorkeeper/wiki/Customizing-the-response-body-when-unauthorized), we can customize the respond body overwriting the method ```doorkeeper_unauthorized_render_options```.\r\n\r\nHowever, it is currently impossible to display the three different reasons of unauthorized: ```revoked```, ```expired```, ```unknown``` which is accessible via the object ```OAuth::InvalidTokenResponse```.\r\n\r\nIt would be great if we can modify the definition of ```doorkeeper_unauthorized_render_options``` to passing the ```error``` object inside the method ```doorkeeper_render_error_with``` via the method ```doorkeeper_render_options``` to ```doorkeeper_unauthorized_render_options```:\r\n\r\n```ruby\r\n      def doorkeeper_render_error_with(error)\r\n        options = doorkeeper_render_options(error) || {}\r\n        if options.blank?\r\n          head error.status\r\n        else\r\n          options[:status] = error.status\r\n          options[:layout] = false if options[:layout].nil?\r\n          render options\r\n        end\r\n      end\r\n```\r\n\r\n```ruby\r\n      def doorkeeper_render_options(error)\r\n        if doorkeeper_invalid_token_response?\r\n          doorkeeper_unauthorized_render_options(error)\r\n        else\r\n          doorkeeper_forbidden_render_options(error)\r\n        end\r\n      end\r\n```\r\n"}}