{"action":"created","issue":{"url":"https://api.github.com/repos/opro/opro/issues/52","labels_url":"https://api.github.com/repos/opro/opro/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/opro/opro/issues/52/comments","events_url":"https://api.github.com/repos/opro/opro/issues/52/events","html_url":"https://github.com/opro/opro/issues/52","id":119843409,"number":52,"title":"Customizing Opro::Oauth::TokenController","user":{"login":"bodrovis","id":646942,"avatar_url":"https://avatars.githubusercontent.com/u/646942?v=3","gravatar_id":"","url":"https://api.github.com/users/bodrovis","html_url":"https://github.com/bodrovis","followers_url":"https://api.github.com/users/bodrovis/followers","following_url":"https://api.github.com/users/bodrovis/following{/other_user}","gists_url":"https://api.github.com/users/bodrovis/gists{/gist_id}","starred_url":"https://api.github.com/users/bodrovis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodrovis/subscriptions","organizations_url":"https://api.github.com/users/bodrovis/orgs","repos_url":"https://api.github.com/users/bodrovis/repos","events_url":"https://api.github.com/users/bodrovis/events{/privacy}","received_events_url":"https://api.github.com/users/bodrovis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-02T00:57:01Z","updated_at":"2015-12-03T23:15:28Z","closed_at":null,"body":"Hello!\r\n\r\nCurrently I am writing an article about opro (probably you've seen it on Sitepoint's Trello board). It seems that TokenController is not meant to be customizable, however what I wanted to do is to return a bit more information when presenting a token, for example, some info about a user who is authenticating. https://github.com/opro/opro/blob/ecffe22e777bb9cacfedd55d059a2ca3cb163a05/app/controllers/opro/oauth/token_controller.rb#L15 Like, you know, when authenticating via Twitter we get a pretty big hash of various data about a user apart from token (name, avatar, followers count etc). I could've created some custom controller action and after receiving a token just make individual request there, but that seems a bit cumbersome to me.\r\n\r\nMaybe you could recommend something? I'd be very grateful. :)"},"comment":{"url":"https://api.github.com/repos/opro/opro/issues/comments/161819767","html_url":"https://github.com/opro/opro/issues/52#issuecomment-161819767","issue_url":"https://api.github.com/repos/opro/opro/issues/52","id":161819767,"user":{"login":"bodrovis","id":646942,"avatar_url":"https://avatars.githubusercontent.com/u/646942?v=3","gravatar_id":"","url":"https://api.github.com/users/bodrovis","html_url":"https://github.com/bodrovis","followers_url":"https://api.github.com/users/bodrovis/followers","following_url":"https://api.github.com/users/bodrovis/following{/other_user}","gists_url":"https://api.github.com/users/bodrovis/gists{/gist_id}","starred_url":"https://api.github.com/users/bodrovis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bodrovis/subscriptions","organizations_url":"https://api.github.com/users/bodrovis/orgs","repos_url":"https://api.github.com/users/bodrovis/repos","events_url":"https://api.github.com/users/bodrovis/events{/privacy}","received_events_url":"https://api.github.com/users/bodrovis/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T23:15:27Z","updated_at":"2015-12-03T23:15:27Z","body":"@schneems Thank you for detailed explanations :) Yeah, I understand how this all can be redefined, but currently I haven't found a way to actually redefine the route to point to a new TokenController. Therefore I submitted this PR https://github.com/opro/opro/pull/54 The basic idea is that anyone can point route to a new token controller and then redefine the `.json` view as needed. For me the befit of using a separate `.json` view is that I can only change it without touching controller's method at all (and without introducing any additional methods) for example like this:\r\n\r\n```\r\nclass TokenController < Opro::Oauth::TokenController\r\n  def create\r\n    super\r\n    render 'auth/create' # points to my custom view\r\n  end\r\nend\r\n```\r\n\r\nTomorrow I am going to update my source code for the article and demonstrate that idea a bit more clearly.\r\n\r\nOf course I've heard about Doorkeeper but as long as my goal is to cover various solutions, I am writing about everything that seems viable to me :) Probably the article will be composed of two parts, I'll send a link then."}}