Skip to content

Commit 4599adf

Browse files
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
1 parent 667e70c commit 4599adf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_auth/registration/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ def validate(self, attrs):
6363
# http://stackoverflow.com/questions/8666316/facebook-oauth-2-0-code-and-token
6464

6565
# Case 1: We received the access_token
66-
if 'access_token' in attrs:
66+
if 'access_token' in attrs and attrs.get('access_token'):
6767
access_token = attrs.get('access_token')
6868

6969
# Case 2: We received the authorization code
70-
elif 'code' in attrs:
70+
elif 'code' in attrs and attrs.get('code'):
7171
self.callback_url = getattr(view, 'callback_url', None)
7272
self.client_class = getattr(view, 'client_class', None)
7373

0 commit comments

Comments
 (0)