python-social-auth/social-core

VK convert-token issue

grindnoise opened this issue · 3 comments

Hi! I'm using drf-social-oauth2 based on python-social-auth to implement oauth2.
The issue is that when I pass VK (vk.com) access token to api's convert-token url, I get 500 response (vk access token received on Android device):
Снимок экрана 2022-01-31 в 15 50 53

And this one by posting token from iOS device:
Снимок экрана 2022-01-31 в 15 53 16

Meanwhile Facebook works fine.
Maybe someone could fix this?

1/2 of headache is gone. The problem was API_VERSION - I used same constant in my settings.py
Снимок экрана 2022-01-31 в 16 33 03

Successfully converted token received via android. the problem with iOS persists. Got that message, saying:
"(access_denied) User revoke access to the token <oauthlib.Request SANITIZED>"

Got that response at vk_api(self, 'users.get', {
'access_token': access_token,
'fields': fields,
}) (vk.py):

{'error': {'error_code': 5, 'error_msg': 'User authorization failed: access_token was given to another ip address.', 'request_params': [{'key': 'fields', 'value': 'first_name,photo,screen_name,last_name,nickname'}, {'key': 'v', 'value': '5.131'}, {'key': 'method', 'value': 'users.get'}, {'key': 'oauth', 'value': '1'}]}}

Maybe someone faced it?

Problem solved. VK access token is bound to IP address, details:
{'error': {'error_code': 5, 'error_msg': 'User authorization failed: access_token was given to another ip address.', 'request_params': [{'key': 'fields', 'value': 'last_name,screen_name,nickname,first_name,photo'}, {'key': 'v', 'value': '5.131'}, {'key': 'method', 'value': 'users.get'}, {'key': 'oauth', 'value': '1'}]}}

Solution is to add offline to SOCIAL_AUTH_VK_OAUTH2_SCOPE