Skip to content

Commit

Permalink
Address GitHub deprecation not yet fixed in social-auth-core v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Feb 19, 2020
1 parent 4c4ff5e commit a990aa8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tcms_github_app/backend.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down

0 comments on commit a990aa8

Please # to comment.