mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-25 18:43:44 +03:00
fix: social login using auth code flow
'access_token' in attrs always returns True, we need to check whether the token is empty or not
This commit is contained in:
parent
667e70c40f
commit
4599adf92b
|
@ -63,11 +63,11 @@ class SocialLoginSerializer(serializers.Serializer):
|
||||||
# http://stackoverflow.com/questions/8666316/facebook-oauth-2-0-code-and-token
|
# http://stackoverflow.com/questions/8666316/facebook-oauth-2-0-code-and-token
|
||||||
|
|
||||||
# Case 1: We received the access_token
|
# Case 1: We received the access_token
|
||||||
if 'access_token' in attrs:
|
if 'access_token' in attrs and attrs.get('access_token'):
|
||||||
access_token = attrs.get('access_token')
|
access_token = attrs.get('access_token')
|
||||||
|
|
||||||
# Case 2: We received the authorization code
|
# Case 2: We received the authorization code
|
||||||
elif 'code' in attrs:
|
elif 'code' in attrs and attrs.get('code'):
|
||||||
self.callback_url = getattr(view, 'callback_url', None)
|
self.callback_url = getattr(view, 'callback_url', None)
|
||||||
self.client_class = getattr(view, 'client_class', None)
|
self.client_class = getattr(view, 'client_class', None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user