{"action":"created","comment":{"url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/comments/216616200","pull_request_review_id":154135963,"id":216616200,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjYxNjIwMA==","diff_hunk":"@@ -24,6 +24,12 @@ def wrapper(cls, root, info, provider, access_token, **kwargs):\n         if user is None:\n             raise exceptions.GraphQLSocialAuthError(_('Invalid token'))\n \n+        user_model = strategy.storage.user.user_model()\n+\n+        if not isinstance(user, user_model):\n+            raise exceptions.GraphQLSocialAuthError(\n+                _('`{}` is not a user instance').format(type(user).__name__))","path":"graphql_social_auth/decorators.py","position":8,"original_position":8,"commit_id":"844e8a1d1699fafaeb602b082a004d1e4d943cba","original_commit_id":"844e8a1d1699fafaeb602b082a004d1e4d943cba","user":{"login":"pjdelport","id":630271,"node_id":"MDQ6VXNlcjYzMDI3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/630271?v=4","gravatar_id":"","url":"https://api.github.com/users/pjdelport","html_url":"https://github.com/pjdelport","followers_url":"https://api.github.com/users/pjdelport/followers","following_url":"https://api.github.com/users/pjdelport/following{/other_user}","gists_url":"https://api.github.com/users/pjdelport/gists{/gist_id}","starred_url":"https://api.github.com/users/pjdelport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjdelport/subscriptions","organizations_url":"https://api.github.com/users/pjdelport/orgs","repos_url":"https://api.github.com/users/pjdelport/repos","events_url":"https://api.github.com/users/pjdelport/events{/privacy}","received_events_url":"https://api.github.com/users/pjdelport/received_events","type":"User","site_admin":false},"body":"Just for some context, here's one way client applications can use the `GraphQLSocialAuthResultIsNotUser` exception from #7, based on how we're doing it currently for our application:\r\n\r\n(Here `graphql_social_auth_hacks.SocialAuthMutation` is the code proposed in #7: that is, identical to the current `SocialAuthMutation`, except that it raises non-user results as `GraphQLSocialAuthResultIsNotUser`.)\r\n\r\n```python\r\nclass SocialAuthMutation_Redirectable(graphql_social_auth_hacks.SocialAuthMutation):\r\n    \"\"\"\r\n    Extend `SocialAuthMutation` with handling of HTTP redirects by the auth pipeline.\r\n    \"\"\"\r\n\r\n    class Meta:\r\n        abstract = True\r\n\r\n    redirect_url = graphene.String(\r\n        required=False,\r\n        description='If set, the user should be redirected to this URL.',\r\n    )\r\n\r\n    @classmethod\r\n    def mutate( cls, root, info, provider, access_token, **kwargs):\r\n        \"\"\"\r\n        Handle `GraphQLSocialAuthResultIsNotUser` for HTTP redirects by calling `resolve_redirect`.\r\n        \"\"\"\r\n        try:\r\n            return super().mutate(root, info, provider, access_token, **kwargs)\r\n        except graphql_social_auth_hacks.GraphQLSocialAuthResultIsNotUser as e:\r\n            if isinstance(e.result, HttpResponseRedirectBase):\r\n                redirect: HttpResponseRedirectBase = e.result\r\n                return cls.resolve_redirect(root, info, redirect, **kwargs)\r\n            else:\r\n                # If the result is not an HTTP redirect, just re-raise.\r\n                raise\r\n\r\n    @classmethod\r\n    def resolve_redirect( cls, root, info, redirect: HttpResponseRedirectBase, **kwargs):\r\n        \"\"\"\r\n        Return HTTP redirects as the `redirect_url` field.\r\n\r\n        The returned `redirect_url` field will be absolute, not relative.\r\n\r\n        :param redirect: An auth pipeline HTTP redirect result.\r\n        \"\"\"\r\n        redirect_url: str = site_utils.site_absolute(redirect.url)\r\n        return cls( redirect_url=redirect_url)\r\n```\r\n\r\nWe use this `SocialAuthMutation_Redirectable` as a base class for our redirectable `SocialAuth` and `SocialAuthJWT` mutation subclasses.","created_at":"2018-09-11T10:11:57Z","updated_at":"2018-09-11T10:11:57Z","html_url":"https://github.com/flavors/django-graphql-social-auth/pull/8#discussion_r216616200","pull_request_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/comments/216616200"},"html":{"href":"https://github.com/flavors/django-graphql-social-auth/pull/8#discussion_r216616200"},"pull_request":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8"}},"in_reply_to_id":214543208},"pull_request":{"url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8","id":209372255,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MzcyMjU1","html_url":"https://github.com/flavors/django-graphql-social-auth/pull/8","diff_url":"https://github.com/flavors/django-graphql-social-auth/pull/8.diff","patch_url":"https://github.com/flavors/django-graphql-social-auth/pull/8.patch","issue_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/8","number":8,"state":"open","locked":false,"title":"Pipeline redirects","user":{"login":"mongkok","id":5514990,"node_id":"MDQ6VXNlcjU1MTQ5OTA=","avatar_url":"https://avatars3.githubusercontent.com/u/5514990?v=4","gravatar_id":"","url":"https://api.github.com/users/mongkok","html_url":"https://github.com/mongkok","followers_url":"https://api.github.com/users/mongkok/followers","following_url":"https://api.github.com/users/mongkok/following{/other_user}","gists_url":"https://api.github.com/users/mongkok/gists{/gist_id}","starred_url":"https://api.github.com/users/mongkok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongkok/subscriptions","organizations_url":"https://api.github.com/users/mongkok/orgs","repos_url":"https://api.github.com/users/mongkok/repos","events_url":"https://api.github.com/users/mongkok/events{/privacy}","received_events_url":"https://api.github.com/users/mongkok/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-19T18:11:32Z","updated_at":"2018-09-11T10:11:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c4a204251d44f8ac3ca3c7334e6d1822dddc80c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8/commits","review_comments_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8/comments","review_comment_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/8/comments","statuses_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/statuses/844e8a1d1699fafaeb602b082a004d1e4d943cba","head":{"label":"flavors:pipeline-redirects","ref":"pipeline-redirects","sha":"844e8a1d1699fafaeb602b082a004d1e4d943cba","user":{"login":"flavors","id":27956417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3OTU2NDE3","avatar_url":"https://avatars0.githubusercontent.com/u/27956417?v=4","gravatar_id":"","url":"https://api.github.com/users/flavors","html_url":"https://github.com/flavors","followers_url":"https://api.github.com/users/flavors/followers","following_url":"https://api.github.com/users/flavors/following{/other_user}","gists_url":"https://api.github.com/users/flavors/gists{/gist_id}","starred_url":"https://api.github.com/users/flavors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavors/subscriptions","organizations_url":"https://api.github.com/users/flavors/orgs","repos_url":"https://api.github.com/users/flavors/repos","events_url":"https://api.github.com/users/flavors/events{/privacy}","received_events_url":"https://api.github.com/users/flavors/received_events","type":"Organization","site_admin":false},"repo":{"id":117433304,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc0MzMzMDQ=","name":"django-graphql-social-auth","full_name":"flavors/django-graphql-social-auth","owner":{"login":"flavors","id":27956417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3OTU2NDE3","avatar_url":"https://avatars0.githubusercontent.com/u/27956417?v=4","gravatar_id":"","url":"https://api.github.com/users/flavors","html_url":"https://github.com/flavors","followers_url":"https://api.github.com/users/flavors/followers","following_url":"https://api.github.com/users/flavors/following{/other_user}","gists_url":"https://api.github.com/users/flavors/gists{/gist_id}","starred_url":"https://api.github.com/users/flavors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavors/subscriptions","organizations_url":"https://api.github.com/users/flavors/orgs","repos_url":"https://api.github.com/users/flavors/repos","events_url":"https://api.github.com/users/flavors/events{/privacy}","received_events_url":"https://api.github.com/users/flavors/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flavors/django-graphql-social-auth","description":"Python Social Auth support for Graphene Django","fork":false,"url":"https://api.github.com/repos/flavors/django-graphql-social-auth","forks_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/forks","keys_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/teams","hooks_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/hooks","issue_events_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/events{/number}","events_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/events","assignees_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/assignees{/user}","branches_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/branches{/branch}","tags_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/tags","blobs_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/languages","stargazers_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/stargazers","contributors_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/contributors","subscribers_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/subscribers","subscription_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/subscription","commits_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/contents/{+path}","compare_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/merges","archive_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/downloads","issues_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues{/number}","pulls_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/labels{/name}","releases_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/releases{/id}","deployments_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/deployments","created_at":"2018-01-14T13:39:24Z","updated_at":"2018-09-07T09:15:15Z","pushed_at":"2018-08-19T18:11:33Z","git_url":"git://github.com/flavors/django-graphql-social-auth.git","ssh_url":"git@github.com:flavors/django-graphql-social-auth.git","clone_url":"https://github.com/flavors/django-graphql-social-auth.git","svn_url":"https://github.com/flavors/django-graphql-social-auth","homepage":"https://pypi.python.org/pypi/django-graphql-social-auth","size":39,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":3,"watchers":16,"default_branch":"master"}},"base":{"label":"flavors:master","ref":"master","sha":"38a4d2d78cc4afa56d28bce6796918395c15c679","user":{"login":"flavors","id":27956417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3OTU2NDE3","avatar_url":"https://avatars0.githubusercontent.com/u/27956417?v=4","gravatar_id":"","url":"https://api.github.com/users/flavors","html_url":"https://github.com/flavors","followers_url":"https://api.github.com/users/flavors/followers","following_url":"https://api.github.com/users/flavors/following{/other_user}","gists_url":"https://api.github.com/users/flavors/gists{/gist_id}","starred_url":"https://api.github.com/users/flavors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavors/subscriptions","organizations_url":"https://api.github.com/users/flavors/orgs","repos_url":"https://api.github.com/users/flavors/repos","events_url":"https://api.github.com/users/flavors/events{/privacy}","received_events_url":"https://api.github.com/users/flavors/received_events","type":"Organization","site_admin":false},"repo":{"id":117433304,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc0MzMzMDQ=","name":"django-graphql-social-auth","full_name":"flavors/django-graphql-social-auth","owner":{"login":"flavors","id":27956417,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3OTU2NDE3","avatar_url":"https://avatars0.githubusercontent.com/u/27956417?v=4","gravatar_id":"","url":"https://api.github.com/users/flavors","html_url":"https://github.com/flavors","followers_url":"https://api.github.com/users/flavors/followers","following_url":"https://api.github.com/users/flavors/following{/other_user}","gists_url":"https://api.github.com/users/flavors/gists{/gist_id}","starred_url":"https://api.github.com/users/flavors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavors/subscriptions","organizations_url":"https://api.github.com/users/flavors/orgs","repos_url":"https://api.github.com/users/flavors/repos","events_url":"https://api.github.com/users/flavors/events{/privacy}","received_events_url":"https://api.github.com/users/flavors/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flavors/django-graphql-social-auth","description":"Python Social Auth support for Graphene Django","fork":false,"url":"https://api.github.com/repos/flavors/django-graphql-social-auth","forks_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/forks","keys_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/teams","hooks_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/hooks","issue_events_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/events{/number}","events_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/events","assignees_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/assignees{/user}","branches_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/branches{/branch}","tags_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/tags","blobs_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/languages","stargazers_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/stargazers","contributors_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/contributors","subscribers_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/subscribers","subscription_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/subscription","commits_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/contents/{+path}","compare_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/merges","archive_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/downloads","issues_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues{/number}","pulls_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/labels{/name}","releases_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/releases{/id}","deployments_url":"https://api.github.com/repos/flavors/django-graphql-social-auth/deployments","created_at":"2018-01-14T13:39:24Z","updated_at":"2018-09-07T09:15:15Z","pushed_at":"2018-08-19T18:11:33Z","git_url":"git://github.com/flavors/django-graphql-social-auth.git","ssh_url":"git@github.com:flavors/django-graphql-social-auth.git","clone_url":"https://github.com/flavors/django-graphql-social-auth.git","svn_url":"https://github.com/flavors/django-graphql-social-auth","homepage":"https://pypi.python.org/pypi/django-graphql-social-auth","size":39,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":3,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8"},"html":{"href":"https://github.com/flavors/django-graphql-social-auth/pull/8"},"issue":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/8"},"comments":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/flavors/django-graphql-social-auth/statuses/844e8a1d1699fafaeb602b082a004d1e4d943cba"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"pjdelport"}}