{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/comments/177134483","pull_request_review_id":106955144,"id":177134483,"diff_hunk":"@@ -63,7 +63,16 @@ def get(self, request):\n             # Make sure that nonce is not used twice\n             del request.session['oidc_nonce']\n \n-        if 'code' in request.GET and 'state' in request.GET:\n+        if request.GET.get('error'):\n+            # Ouch! Something important failed.\n+            # Make sure the user doesn't get to continue to be logged in\n+            # otherwise the refresh middleware will force the user to\n+            # redirect to authorize again if the session refresh has\n+            # expired.\n+            if is_authenticated(request.user):\n+                auth.logout(request)\n+            assert not is_authenticated(request.user)","path":"mozilla_django_oidc/views.py","position":13,"original_position":13,"commit_id":"88d7fb6ab5a599996ab40b97e46b184bd4ea769e","original_commit_id":"88d7fb6ab5a599996ab40b97e46b184bd4ea769e","user":{"login":"akatsoulas","id":900565,"avatar_url":"https://avatars3.githubusercontent.com/u/900565?v=4","gravatar_id":"","url":"https://api.github.com/users/akatsoulas","html_url":"https://github.com/akatsoulas","followers_url":"https://api.github.com/users/akatsoulas/followers","following_url":"https://api.github.com/users/akatsoulas/following{/other_user}","gists_url":"https://api.github.com/users/akatsoulas/gists{/gist_id}","starred_url":"https://api.github.com/users/akatsoulas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akatsoulas/subscriptions","organizations_url":"https://api.github.com/users/akatsoulas/orgs","repos_url":"https://api.github.com/users/akatsoulas/repos","events_url":"https://api.github.com/users/akatsoulas/events{/privacy}","received_events_url":"https://api.github.com/users/akatsoulas/received_events","type":"User","site_admin":false},"body":"I didn't do a review because @willkg did all the hard work here. Logging the user out sounds good to me","created_at":"2018-03-26T15:31:22Z","updated_at":"2018-03-26T15:31:22Z","html_url":"https://github.com/mozilla/mozilla-django-oidc/pull/213#discussion_r177134483","pull_request_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/comments/177134483"},"html":{"href":"https://github.com/mozilla/mozilla-django-oidc/pull/213#discussion_r177134483"},"pull_request":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213"}},"in_reply_to_id":175560359},"pull_request":{"url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213","id":175992343,"html_url":"https://github.com/mozilla/mozilla-django-oidc/pull/213","diff_url":"https://github.com/mozilla/mozilla-django-oidc/pull/213.diff","patch_url":"https://github.com/mozilla/mozilla-django-oidc/pull/213.patch","issue_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues/213","number":213,"state":"open","locked":false,"title":"Log out when session refresh fails","user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars2.githubusercontent.com/u/26739?v=4","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"body":"I admit that I did this quite hastily. But the principle is sound. If the callback is unhappy with the client, the client shouldn't be allowed to stay logged in. Not just in principle but because if you're allowed to stay logged in, when you reach the login_failure URL (whatever that is) the middleware might think it's time to refresh your session and you get swept up in a loop. \r\n","created_at":"2018-03-19T18:48:57Z","updated_at":"2018-03-26T15:31:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e27f6925de15ee912ae0959b1a373f737fd08ca","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213/commits","review_comments_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213/comments","review_comment_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues/213/comments","statuses_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/statuses/88d7fb6ab5a599996ab40b97e46b184bd4ea769e","head":{"label":"peterbe:log-out-when-session-refresh-fails","ref":"log-out-when-session-refresh-fails","sha":"88d7fb6ab5a599996ab40b97e46b184bd4ea769e","user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars2.githubusercontent.com/u/26739?v=4","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"repo":{"id":91585016,"name":"mozilla-django-oidc","full_name":"peterbe/mozilla-django-oidc","owner":{"login":"peterbe","id":26739,"avatar_url":"https://avatars2.githubusercontent.com/u/26739?v=4","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peterbe/mozilla-django-oidc","description":"A django OpenID Connect library","fork":true,"url":"https://api.github.com/repos/peterbe/mozilla-django-oidc","forks_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/forks","keys_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/teams","hooks_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/hooks","issue_events_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/issues/events{/number}","events_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/events","assignees_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/assignees{/user}","branches_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/branches{/branch}","tags_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/tags","blobs_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/statuses/{sha}","languages_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/languages","stargazers_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/stargazers","contributors_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/contributors","subscribers_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/subscribers","subscription_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/subscription","commits_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/issues/comments{/number}","contents_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/contents/{+path}","compare_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/merges","archive_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/downloads","issues_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/issues{/number}","pulls_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/pulls{/number}","milestones_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/milestones{/number}","notifications_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/labels{/name}","releases_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/releases{/id}","deployments_url":"https://api.github.com/repos/peterbe/mozilla-django-oidc/deployments","created_at":"2017-05-17T14:23:03Z","updated_at":"2017-05-17T14:23:04Z","pushed_at":"2018-03-20T13:13:44Z","git_url":"git://github.com/peterbe/mozilla-django-oidc.git","ssh_url":"git@github.com:peterbe/mozilla-django-oidc.git","clone_url":"https://github.com/peterbe/mozilla-django-oidc.git","svn_url":"https://github.com/peterbe/mozilla-django-oidc","homepage":null,"size":256,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"da3d49a275c1f7bfba49a1f6b9d017090a566325","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":70578420,"name":"mozilla-django-oidc","full_name":"mozilla/mozilla-django-oidc","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/mozilla-django-oidc","description":"A django OpenID Connect library","fork":false,"url":"https://api.github.com/repos/mozilla/mozilla-django-oidc","forks_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/forks","keys_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/teams","hooks_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/hooks","issue_events_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/events","assignees_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/tags","blobs_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/languages","stargazers_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/stargazers","contributors_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/contributors","subscribers_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/subscribers","subscription_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/subscription","commits_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/merges","archive_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/downloads","issues_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/mozilla-django-oidc/deployments","created_at":"2016-10-11T09:37:45Z","updated_at":"2018-03-20T13:13:02Z","pushed_at":"2018-03-23T08:04:04Z","git_url":"git://github.com/mozilla/mozilla-django-oidc.git","ssh_url":"git@github.com:mozilla/mozilla-django-oidc.git","clone_url":"https://github.com/mozilla/mozilla-django-oidc.git","svn_url":"https://github.com/mozilla/mozilla-django-oidc","homepage":"https://mozilla-django-oidc.readthedocs.io","size":251,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":31,"open_issues":29,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213"},"html":{"href":"https://github.com/mozilla/mozilla-django-oidc/pull/213"},"issue":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues/213"},"comments":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/issues/213/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/pulls/213/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/mozilla-django-oidc/statuses/88d7fb6ab5a599996ab40b97e46b184bd4ea769e"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"akatsoulas"}}