{"action":"closed","number":440,"pull_request":{"url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/440","id":63451137,"html_url":"https://github.com/SumOfUs/Champaign/pull/440","diff_url":"https://github.com/SumOfUs/Champaign/pull/440.diff","patch_url":"https://github.com/SumOfUs/Champaign/pull/440.patch","issue_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/440","number":440,"state":"closed","locked":false,"title":"Member Oauth","user":{"login":"NealJMD","id":102218,"avatar_url":"https://avatars.githubusercontent.com/u/102218?v=3","gravatar_id":"","url":"https://api.github.com/users/NealJMD","html_url":"https://github.com/NealJMD","followers_url":"https://api.github.com/users/NealJMD/followers","following_url":"https://api.github.com/users/NealJMD/following{/other_user}","gists_url":"https://api.github.com/users/NealJMD/gists{/gist_id}","starred_url":"https://api.github.com/users/NealJMD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NealJMD/subscriptions","organizations_url":"https://api.github.com/users/NealJMD/orgs","repos_url":"https://api.github.com/users/NealJMD/repos","events_url":"https://api.github.com/users/NealJMD/events{/privacy}","received_events_url":"https://api.github.com/users/NealJMD/received_events","type":"User","site_admin":false},"body":"This is my first work toward making Members be able to authenticate on Champaign. The tricky thing is that Devise [does not support multiple login models that all have OAuth](https://github.com/plataformatec/devise/wiki/OmniAuth-with-multiple-models). I followed their instructions in terms of config, but I found that it didn't get me all the way there.\r\n\r\nWhat I've done -\r\n- Added a bunch of fields to the Member model with a migration generated by Devise.\r\n- Removed `:omniauthable` from the models and added the relevant config to make the Omniauth gem work without that.\r\n- Added a bunch of routes and actions to let us call either `member_authorization_path('google_oauth2')` or `user_authorization_path('google_oauth2')` that successfully makes it through to the callback method with either `'member'` or `'user'` in `session[:authenticating]`. \r\n\r\nWhat still needs to be done\r\n- pass the `'member'` or `'user'` param through to `ConnectWithOauthProvider` and make it be able to find and create `Member` instances, not just `User` instances. \r\n- add the fields `uid` and `provider` to the `Member` table\r\n- add a UI to let members log in\r\n- write tests for all this stuff\r\n\r\nGood stuff to know\r\n- the Omniauth gem seems a lot like magic because it works on rack, intercepting a couple routes. Specifically, if you call `/auth/:provider` where `:provider` is any provider defined in `omniauth.rb`, then it will automatically push you to that Oauth flow, and call back to `/auth/:provider/callback`.\r\n- if you want to change the callback route, you have to authorize it in the google [action-rails console](https://console.developers.google.com/apis/credentials?project=action-rails-86921)\r\n- the AuthenticationsController inherits from [`Devise::OmniauthCallbacksController`](https://github.com/plataformatec/devise/blob/dd5de829c944dd955e4b35074c60798c3ad4b947/app/controllers/devise/omniauth_callbacks_controller.rb), so you can call its private methods to help with error handling.\r\n\r\nGood luck!","created_at":"2016-03-18T23:59:26Z","updated_at":"2016-06-07T08:54:20Z","closed_at":"2016-06-07T08:54:20Z","merged_at":null,"merge_commit_sha":"5e938a930b97b0f062074e4793fb086adaaab6c0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/440/commits","review_comments_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/440/comments","review_comment_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/440/comments","statuses_url":"https://api.github.com/repos/SumOfUs/Champaign/statuses/52c3b0b7af8973e4e50ade472ed67e1c9e1031ac","head":{"label":"SumOfUs:member-oauth","ref":"member-oauth","sha":"52c3b0b7af8973e4e50ade472ed67e1c9e1031ac","user":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"repo":{"id":33684818,"name":"Champaign","full_name":"SumOfUs/Champaign","owner":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SumOfUs/Champaign","description":"SumOfUs Online Campaign Platform.","fork":false,"url":"https://api.github.com/repos/SumOfUs/Champaign","forks_url":"https://api.github.com/repos/SumOfUs/Champaign/forks","keys_url":"https://api.github.com/repos/SumOfUs/Champaign/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SumOfUs/Champaign/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SumOfUs/Champaign/teams","hooks_url":"https://api.github.com/repos/SumOfUs/Champaign/hooks","issue_events_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/events{/number}","events_url":"https://api.github.com/repos/SumOfUs/Champaign/events","assignees_url":"https://api.github.com/repos/SumOfUs/Champaign/assignees{/user}","branches_url":"https://api.github.com/repos/SumOfUs/Champaign/branches{/branch}","tags_url":"https://api.github.com/repos/SumOfUs/Champaign/tags","blobs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SumOfUs/Champaign/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/refs{/sha}","trees_url":"https://api.github.com/repos/SumOfUs/Champaign/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SumOfUs/Champaign/statuses/{sha}","languages_url":"https://api.github.com/repos/SumOfUs/Champaign/languages","stargazers_url":"https://api.github.com/repos/SumOfUs/Champaign/stargazers","contributors_url":"https://api.github.com/repos/SumOfUs/Champaign/contributors","subscribers_url":"https://api.github.com/repos/SumOfUs/Champaign/subscribers","subscription_url":"https://api.github.com/repos/SumOfUs/Champaign/subscription","commits_url":"https://api.github.com/repos/SumOfUs/Champaign/commits{/sha}","git_commits_url":"https://api.github.com/repos/SumOfUs/Champaign/git/commits{/sha}","comments_url":"https://api.github.com/repos/SumOfUs/Champaign/comments{/number}","issue_comment_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/comments{/number}","contents_url":"https://api.github.com/repos/SumOfUs/Champaign/contents/{+path}","compare_url":"https://api.github.com/repos/SumOfUs/Champaign/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SumOfUs/Champaign/merges","archive_url":"https://api.github.com/repos/SumOfUs/Champaign/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SumOfUs/Champaign/downloads","issues_url":"https://api.github.com/repos/SumOfUs/Champaign/issues{/number}","pulls_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls{/number}","milestones_url":"https://api.github.com/repos/SumOfUs/Champaign/milestones{/number}","notifications_url":"https://api.github.com/repos/SumOfUs/Champaign/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SumOfUs/Champaign/labels{/name}","releases_url":"https://api.github.com/repos/SumOfUs/Champaign/releases{/id}","deployments_url":"https://api.github.com/repos/SumOfUs/Champaign/deployments","created_at":"2015-04-09T18:16:20Z","updated_at":"2016-06-01T12:22:56Z","pushed_at":"2016-06-07T00:36:31Z","git_url":"git://github.com/SumOfUs/Champaign.git","ssh_url":"git@github.com:SumOfUs/Champaign.git","clone_url":"https://github.com/SumOfUs/Champaign.git","svn_url":"https://github.com/SumOfUs/Champaign","homepage":null,"size":8633,"stargazers_count":24,"watchers_count":24,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":13,"forks":10,"open_issues":13,"watchers":24,"default_branch":"development"}},"base":{"label":"SumOfUs:development","ref":"development","sha":"018f6b6c953e0bc565a887fde7e2344198b77947","user":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"repo":{"id":33684818,"name":"Champaign","full_name":"SumOfUs/Champaign","owner":{"login":"SumOfUs","id":7574652,"avatar_url":"https://avatars.githubusercontent.com/u/7574652?v=3","gravatar_id":"","url":"https://api.github.com/users/SumOfUs","html_url":"https://github.com/SumOfUs","followers_url":"https://api.github.com/users/SumOfUs/followers","following_url":"https://api.github.com/users/SumOfUs/following{/other_user}","gists_url":"https://api.github.com/users/SumOfUs/gists{/gist_id}","starred_url":"https://api.github.com/users/SumOfUs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SumOfUs/subscriptions","organizations_url":"https://api.github.com/users/SumOfUs/orgs","repos_url":"https://api.github.com/users/SumOfUs/repos","events_url":"https://api.github.com/users/SumOfUs/events{/privacy}","received_events_url":"https://api.github.com/users/SumOfUs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SumOfUs/Champaign","description":"SumOfUs Online Campaign Platform.","fork":false,"url":"https://api.github.com/repos/SumOfUs/Champaign","forks_url":"https://api.github.com/repos/SumOfUs/Champaign/forks","keys_url":"https://api.github.com/repos/SumOfUs/Champaign/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SumOfUs/Champaign/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SumOfUs/Champaign/teams","hooks_url":"https://api.github.com/repos/SumOfUs/Champaign/hooks","issue_events_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/events{/number}","events_url":"https://api.github.com/repos/SumOfUs/Champaign/events","assignees_url":"https://api.github.com/repos/SumOfUs/Champaign/assignees{/user}","branches_url":"https://api.github.com/repos/SumOfUs/Champaign/branches{/branch}","tags_url":"https://api.github.com/repos/SumOfUs/Champaign/tags","blobs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SumOfUs/Champaign/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SumOfUs/Champaign/git/refs{/sha}","trees_url":"https://api.github.com/repos/SumOfUs/Champaign/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SumOfUs/Champaign/statuses/{sha}","languages_url":"https://api.github.com/repos/SumOfUs/Champaign/languages","stargazers_url":"https://api.github.com/repos/SumOfUs/Champaign/stargazers","contributors_url":"https://api.github.com/repos/SumOfUs/Champaign/contributors","subscribers_url":"https://api.github.com/repos/SumOfUs/Champaign/subscribers","subscription_url":"https://api.github.com/repos/SumOfUs/Champaign/subscription","commits_url":"https://api.github.com/repos/SumOfUs/Champaign/commits{/sha}","git_commits_url":"https://api.github.com/repos/SumOfUs/Champaign/git/commits{/sha}","comments_url":"https://api.github.com/repos/SumOfUs/Champaign/comments{/number}","issue_comment_url":"https://api.github.com/repos/SumOfUs/Champaign/issues/comments{/number}","contents_url":"https://api.github.com/repos/SumOfUs/Champaign/contents/{+path}","compare_url":"https://api.github.com/repos/SumOfUs/Champaign/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SumOfUs/Champaign/merges","archive_url":"https://api.github.com/repos/SumOfUs/Champaign/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SumOfUs/Champaign/downloads","issues_url":"https://api.github.com/repos/SumOfUs/Champaign/issues{/number}","pulls_url":"https://api.github.com/repos/SumOfUs/Champaign/pulls{/number}","milestones_url":"https://api.github.com/repos/SumOfUs/Champaign/milestones{/number}","notifications_url":"https://api.github.com/repos/SumOfUs/Champaign/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SumOfUs/Champaign/labels{/name}","releases_url":"https://api.github.com/repos/SumOfUs/Champaign/releases{/id}","deployments_url":"https://api.github.com/repos/SumOfUs/Champaign/deployments","created_at":"2015-04-09T18:16:20Z","updated_at":"2016-06-01T12:22:56Z","pushed_at":"2016-06-07T00:36:31Z","git_url":"git://github.com/SumOfUs/Champaign.git","ssh_url":"git@github.com:SumOfUs/Champaign.git","clone_url":"https://github.com/SumOfUs/Champaign.git","svn_url":"https://github.com/SumOfUs/Champaign","homepage":null,"size":8633,"stargazers_count":24,"watchers_count":24,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":13,"forks":10,"open_issues":13,"watchers":24,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/440"},"html":{"href":"https://github.com/SumOfUs/Champaign/pull/440"},"issue":{"href":"https://api.github.com/repos/SumOfUs/Champaign/issues/440"},"comments":{"href":"https://api.github.com/repos/SumOfUs/Champaign/issues/440/comments"},"review_comments":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/440/comments"},"review_comment":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SumOfUs/Champaign/pulls/440/commits"},"statuses":{"href":"https://api.github.com/repos/SumOfUs/Champaign/statuses/52c3b0b7af8973e4e50ade472ed67e1c9e1031ac"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":4,"review_comments":0,"commits":4,"additions":195,"deletions":65,"changed_files":15}}
{"actor":{"display_login":"osahyoun"}}