From a990aa8dfc5e25c2fe072cd499e37ca15e9ad7e9 Mon Sep 17 00:00:00 2001 From: "Mr. Senko" Date: Wed, 19 Feb 2020 13:17:40 +0200 Subject: [PATCH] Address GitHub deprecation not yet fixed in social-auth-core v3.2.0 Reported in: https://github.com/python-social-auth/social-core/issues/430 Patch in: https://github.com/python-social-auth/social-core/pull/428 --- tcms_github_app/backend.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tcms_github_app/backend.py b/tcms_github_app/backend.py index ba49cd8..fc4de93 100644 --- a/tcms_github_app/backend.py +++ b/tcms_github_app/backend.py @@ -1,3 +1,5 @@ +from six.moves.urllib.parse import urljoin + from social_core.backends.github import GithubOAuth2 from social_core.utils import handle_http_errors @@ -8,6 +10,12 @@ class GithubAppAuth(GithubOAuth2): # pylint: disable=abstract-method """GitHub App OAuth authentication backend""" name = 'github-app' + # copied from https://github.com/python-social-auth/social-core/pull/428 + # and must be removed once we've got a newer social-auth-core + def _user_data(self, access_token, path=None): + url = urljoin(self.api_url(), 'user{0}'.format(path or '')) + return self.get_json(url, headers={'Authorization': 'token {0}'.format(access_token)}) + def validate_state(self): """ Scenario 1: user clicks an icon/button on your website and