Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions social_core/backends/qq.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class QQOAuth2(BaseOAuth2):
name = 'qq'
ID_KEY = 'openid'
ID_KEY = 'unionid'
AUTHORIZE_URL = 'https://graph.qq.com/oauth2.0/authorize'
ACCESS_TOKEN_URL = 'https://graph.qq.com/oauth2.0/token'
AUTHORIZATION_URL = 'https://graph.qq.com/oauth2.0/authorize'
Expand Down Expand Up @@ -48,11 +48,12 @@ def get_user_details(self, response):

def get_openid(self, access_token):
response = self.request(self.OPENID_URL, params={
'access_token': access_token
'access_token': access_token,
'unionid': '1'
})
content = response.content.decode()
data = json.loads(content[10:-3])
return data['openid']
return data['unionid']

def user_data(self, access_token, *args, **kwargs):
openid = self.get_openid(access_token)
Expand All @@ -63,7 +64,7 @@ def user_data(self, access_token, *args, **kwargs):
'openid': openid
}
)
response['openid'] = openid
response['unionid'] = openid
return response

def request_access_token(self, url, data, *args, **kwargs):
Expand Down