{"action":"created","comment":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments/141271091","pull_request_review_id":65458342,"id":141271091,"diff_hunk":"@@ -331,4 +331,18 @@\n       it { expect(Doorkeeper.configuration.base_controller).to eq('ApplicationController') }\n     end\n   end\n+  ","path":"spec/lib/config_spec.rb","position":4,"original_position":4,"commit_id":"c8e3f158339b3bbd7100fb29078ba11aac62dd0d","original_commit_id":"c8e3f158339b3bbd7100fb29078ba11aac62dd0d","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Trailing whitespace detected.","created_at":"2017-09-27T08:14:18Z","updated_at":"2017-09-27T08:14:18Z","html_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/992#discussion_r141271091","pull_request_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments/141271091"},"html":{"href":"https://github.com/doorkeeper-gem/doorkeeper/pull/992#discussion_r141271091"},"pull_request":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992"}}},"pull_request":{"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992","id":143324538,"html_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/992","diff_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/992.diff","patch_url":"https://github.com/doorkeeper-gem/doorkeeper/pull/992.patch","issue_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/992","number":992,"state":"open","locked":false,"title":"[WIP] Rails API support","user":{"login":"Borzik","id":2151808,"avatar_url":"https://avatars3.githubusercontent.com/u/2151808?v=4","gravatar_id":"","url":"https://api.github.com/users/Borzik","html_url":"https://github.com/Borzik","followers_url":"https://api.github.com/users/Borzik/followers","following_url":"https://api.github.com/users/Borzik/following{/other_user}","gists_url":"https://api.github.com/users/Borzik/gists{/gist_id}","starred_url":"https://api.github.com/users/Borzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Borzik/subscriptions","organizations_url":"https://api.github.com/users/Borzik/orgs","repos_url":"https://api.github.com/users/Borzik/repos","events_url":"https://api.github.com/users/Borzik/events{/privacy}","received_events_url":"https://api.github.com/users/Borzik/received_events","type":"User","site_admin":false},"body":"This was influenced by #893, but I took a bit different approach and extended functionality to other areas. It is still WIP, but I just wanted to share what is done already, and I'll be glad to get some advices.\r\n\r\nThe main premise for this PR is that usually Rails APIs and frontend apps are running on different domains, so we cannot easily identity users by cookies or something like that (e.g. in our project we use [devise_token_auth](https://github.com/lynndylanhurley/devise_token_auth) and authenticate users by tokens).\r\n\r\nSwitching on `api_mode` configuration will:\r\n- disable request forgery protection, since we assume user is not authenticated by cookies - if he is, there's no much sense in turning `api_mode` on\r\n- remove helpers since we don't rely on HTML views\r\n- render JSON with `status: redirect` and `redirect_uri` instead of directly redirecting user\r\n- disable applications and authorized_applications controller (maybe I will update it to support JSON as well and enable them back - not sure if it's needed though)\r\n\r\nAs a side effects, this PR:\r\n- makes `Doorkeeper::Oauth::PreAuthorization` serializable by as_json method which will provide all information needed to show preauthorization page\r\n- *(I need more information on this one from someone more familiar with project)* sets redirect_uri on `Doorkeeper::Oauth::ErrorResponse` - for some reason, it was not set before. If we render ErrorResponse with api_mode, it will render the same `status: redirect` and `redirect_uri` with error message\r\n\r\nAnyone who will use `api_mode`, will also need some oauth page (which can be easily implemented as a small SPA and that will be running on the same domain as main frontend application). They can make main frontend app do this job, but I assume it is not worth loading the whole app just to show a single dialogue message with Allow/Deny buttons. It will have to be responsible for:\r\n- logging users in\r\n- making pre-auth requests which will return client name, and other information\r\n- sending POST `oauth/authorize`\r\n- redirecting user whenever they get `status: redirect` to `redirect_uri` provided in response\r\n\r\nPlease let me know your thoughts about it.","created_at":"2017-09-27T08:08:50Z","updated_at":"2017-09-27T08:14:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8703928c9ec4e4f187e1858a0d39973918af3566","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992/commits","review_comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992/comments","review_comment_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/992/comments","statuses_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/c8e3f158339b3bbd7100fb29078ba11aac62dd0d","head":{"label":"Borzik:rails-api-support","ref":"rails-api-support","sha":"c8e3f158339b3bbd7100fb29078ba11aac62dd0d","user":{"login":"Borzik","id":2151808,"avatar_url":"https://avatars3.githubusercontent.com/u/2151808?v=4","gravatar_id":"","url":"https://api.github.com/users/Borzik","html_url":"https://github.com/Borzik","followers_url":"https://api.github.com/users/Borzik/followers","following_url":"https://api.github.com/users/Borzik/following{/other_user}","gists_url":"https://api.github.com/users/Borzik/gists{/gist_id}","starred_url":"https://api.github.com/users/Borzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Borzik/subscriptions","organizations_url":"https://api.github.com/users/Borzik/orgs","repos_url":"https://api.github.com/users/Borzik/repos","events_url":"https://api.github.com/users/Borzik/events{/privacy}","received_events_url":"https://api.github.com/users/Borzik/received_events","type":"User","site_admin":false},"repo":{"id":103824447,"name":"doorkeeper","full_name":"Borzik/doorkeeper","owner":{"login":"Borzik","id":2151808,"avatar_url":"https://avatars3.githubusercontent.com/u/2151808?v=4","gravatar_id":"","url":"https://api.github.com/users/Borzik","html_url":"https://github.com/Borzik","followers_url":"https://api.github.com/users/Borzik/followers","following_url":"https://api.github.com/users/Borzik/following{/other_user}","gists_url":"https://api.github.com/users/Borzik/gists{/gist_id}","starred_url":"https://api.github.com/users/Borzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Borzik/subscriptions","organizations_url":"https://api.github.com/users/Borzik/orgs","repos_url":"https://api.github.com/users/Borzik/repos","events_url":"https://api.github.com/users/Borzik/events{/privacy}","received_events_url":"https://api.github.com/users/Borzik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Borzik/doorkeeper","description":"Doorkeeper is an OAuth 2 provider for Rails.","fork":true,"url":"https://api.github.com/repos/Borzik/doorkeeper","forks_url":"https://api.github.com/repos/Borzik/doorkeeper/forks","keys_url":"https://api.github.com/repos/Borzik/doorkeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Borzik/doorkeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Borzik/doorkeeper/teams","hooks_url":"https://api.github.com/repos/Borzik/doorkeeper/hooks","issue_events_url":"https://api.github.com/repos/Borzik/doorkeeper/issues/events{/number}","events_url":"https://api.github.com/repos/Borzik/doorkeeper/events","assignees_url":"https://api.github.com/repos/Borzik/doorkeeper/assignees{/user}","branches_url":"https://api.github.com/repos/Borzik/doorkeeper/branches{/branch}","tags_url":"https://api.github.com/repos/Borzik/doorkeeper/tags","blobs_url":"https://api.github.com/repos/Borzik/doorkeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Borzik/doorkeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Borzik/doorkeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/Borzik/doorkeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Borzik/doorkeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/Borzik/doorkeeper/languages","stargazers_url":"https://api.github.com/repos/Borzik/doorkeeper/stargazers","contributors_url":"https://api.github.com/repos/Borzik/doorkeeper/contributors","subscribers_url":"https://api.github.com/repos/Borzik/doorkeeper/subscribers","subscription_url":"https://api.github.com/repos/Borzik/doorkeeper/subscription","commits_url":"https://api.github.com/repos/Borzik/doorkeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/Borzik/doorkeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/Borzik/doorkeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/Borzik/doorkeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/Borzik/doorkeeper/contents/{+path}","compare_url":"https://api.github.com/repos/Borzik/doorkeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Borzik/doorkeeper/merges","archive_url":"https://api.github.com/repos/Borzik/doorkeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Borzik/doorkeeper/downloads","issues_url":"https://api.github.com/repos/Borzik/doorkeeper/issues{/number}","pulls_url":"https://api.github.com/repos/Borzik/doorkeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/Borzik/doorkeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/Borzik/doorkeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Borzik/doorkeeper/labels{/name}","releases_url":"https://api.github.com/repos/Borzik/doorkeeper/releases{/id}","deployments_url":"https://api.github.com/repos/Borzik/doorkeeper/deployments","created_at":"2017-09-17T11:43:53Z","updated_at":"2017-09-17T11:43:55Z","pushed_at":"2017-09-27T08:14:00Z","git_url":"git://github.com/Borzik/doorkeeper.git","ssh_url":"git@github.com:Borzik/doorkeeper.git","clone_url":"https://github.com/Borzik/doorkeeper.git","svn_url":"https://github.com/Borzik/doorkeeper","homepage":"","size":2040,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"doorkeeper-gem:master","ref":"master","sha":"c586ab379ed8cbac7fa27fd89da9a42441d3d962","user":{"login":"doorkeeper-gem","id":7275750,"avatar_url":"https://avatars1.githubusercontent.com/u/7275750?v=4","gravatar_id":"","url":"https://api.github.com/users/doorkeeper-gem","html_url":"https://github.com/doorkeeper-gem","followers_url":"https://api.github.com/users/doorkeeper-gem/followers","following_url":"https://api.github.com/users/doorkeeper-gem/following{/other_user}","gists_url":"https://api.github.com/users/doorkeeper-gem/gists{/gist_id}","starred_url":"https://api.github.com/users/doorkeeper-gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doorkeeper-gem/subscriptions","organizations_url":"https://api.github.com/users/doorkeeper-gem/orgs","repos_url":"https://api.github.com/users/doorkeeper-gem/repos","events_url":"https://api.github.com/users/doorkeeper-gem/events{/privacy}","received_events_url":"https://api.github.com/users/doorkeeper-gem/received_events","type":"Organization","site_admin":false},"repo":{"id":2802565,"name":"doorkeeper","full_name":"doorkeeper-gem/doorkeeper","owner":{"login":"doorkeeper-gem","id":7275750,"avatar_url":"https://avatars1.githubusercontent.com/u/7275750?v=4","gravatar_id":"","url":"https://api.github.com/users/doorkeeper-gem","html_url":"https://github.com/doorkeeper-gem","followers_url":"https://api.github.com/users/doorkeeper-gem/followers","following_url":"https://api.github.com/users/doorkeeper-gem/following{/other_user}","gists_url":"https://api.github.com/users/doorkeeper-gem/gists{/gist_id}","starred_url":"https://api.github.com/users/doorkeeper-gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doorkeeper-gem/subscriptions","organizations_url":"https://api.github.com/users/doorkeeper-gem/orgs","repos_url":"https://api.github.com/users/doorkeeper-gem/repos","events_url":"https://api.github.com/users/doorkeeper-gem/events{/privacy}","received_events_url":"https://api.github.com/users/doorkeeper-gem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/doorkeeper-gem/doorkeeper","description":"Doorkeeper is an OAuth 2 provider for Rails.","fork":false,"url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper","forks_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/forks","keys_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/teams","hooks_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/hooks","issue_events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/events{/number}","events_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/events","assignees_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/assignees{/user}","branches_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/branches{/branch}","tags_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/tags","blobs_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/languages","stargazers_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/stargazers","contributors_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/contributors","subscribers_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/subscribers","subscription_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/subscription","commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/contents/{+path}","compare_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/merges","archive_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/downloads","issues_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues{/number}","pulls_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/labels{/name}","releases_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/releases{/id}","deployments_url":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/deployments","created_at":"2011-11-18T13:02:01Z","updated_at":"2017-09-27T07:44:40Z","pushed_at":"2017-09-27T08:14:02Z","git_url":"git://github.com/doorkeeper-gem/doorkeeper.git","ssh_url":"git@github.com:doorkeeper-gem/doorkeeper.git","clone_url":"https://github.com/doorkeeper-gem/doorkeeper.git","svn_url":"https://github.com/doorkeeper-gem/doorkeeper","homepage":"","size":2034,"stargazers_count":3645,"watchers_count":3645,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":729,"mirror_url":null,"open_issues_count":59,"forks":729,"open_issues":59,"watchers":3645,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992"},"html":{"href":"https://github.com/doorkeeper-gem/doorkeeper/pull/992"},"issue":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/992"},"comments":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/issues/992/comments"},"review_comments":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992/comments"},"review_comment":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/pulls/992/commits"},"statuses":{"href":"https://api.github.com/repos/doorkeeper-gem/doorkeeper/statuses/c8e3f158339b3bbd7100fb29078ba11aac62dd0d"}},"author_association":"NONE"}}
{"actor":{"display_login":"houndci-bot"}}