From f51ebbeffd110cb9c1efe3f1cf590cbffac2f2d6 Mon Sep 17 00:00:00 2001 From: Luke Burden Date: Wed, 21 Aug 2019 12:59:50 -0700 Subject: [PATCH] Return login data from SocialLoginSerializer.validate for views to use --- rest_auth/registration/serializers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 4f99c18..1e03c47 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -142,6 +142,10 @@ class SocialLoginSerializer(serializers.Serializer): login.lookup() login.save(request, connect=True) + # we return the login data (and so User and SocialAccount instances) here + # such that custom login and connect views can render suitable responses + attrs['login'] = login + # we still return `user` here for backwards compatibility attrs['user'] = login.account.user return attrs