Skip to content

Commit

Permalink
fix(line): updated LINE api version
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimdoublej authored and pennersr committed Feb 14, 2019
1 parent 0ae1f11 commit 8828380
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion allauth/socialaccount/providers/line/provider.py
Expand Up @@ -20,7 +20,14 @@ def get_default_scope(self):
return []

def extract_uid(self, data):
return str(data['mid'])
return str(data['userId'])

def extract_common_fields(self, data):
return dict(email=data.get('email'),
username=data.get('displayName'),
first_name=data.get('first_name'),
last_name=data.get('last_name'),
name=data.get('name'))


provider_classes = [LineProvider]
2 changes: 1 addition & 1 deletion allauth/socialaccount/providers/line/tests.py
Expand Up @@ -10,7 +10,7 @@ class LineTests(OAuth2TestsMixin, TestCase):
def get_mocked_response(self):
return MockedResponse(200, """
{
"mid": "u7d47d26a6bab09b95695ff02d1a36e38",
"userId": "u7d47d26a6bab09b95695ff02d1a36e38",
"displayName": "\uc774\uc0c1\ud601",
"pictureUrl":
"http://dl.profile.line-cdn.net/0m055ab14d725138288331268c45ac5286a35482fb794a"
Expand Down
6 changes: 3 additions & 3 deletions allauth/socialaccount/providers/line/views.py
Expand Up @@ -11,9 +11,9 @@

class LineOAuth2Adapter(OAuth2Adapter):
provider_id = LineProvider.id
access_token_url = 'https://api.line.me/v1/oauth/accessToken'
authorize_url = 'https://access.line.me/dialog/oauth/weblogin'
profile_url = 'https://api.line.me/v1/profile'
access_token_url = 'https://api.line.me/oauth2/v2.1/token'
authorize_url = 'https://access.line.me/oauth2/v2.1/authorize'
profile_url = 'https://api.line.me/v2/profile'

def complete_login(self, request, app, token, **kwargs):
headers = {'Authorization': 'Bearer {0}'.format(token.token)}
Expand Down

0 comments on commit 8828380

Please sign in to comment.