diff --git a/social_core/backends/qq.py b/social_core/backends/qq.py index b740b27a..18defe1c 100644 --- a/social_core/backends/qq.py +++ b/social_core/backends/qq.py @@ -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' @@ -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) @@ -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):