Open math77 opened 5 years ago
did you figure out a solution? im also looking for a way to return more info about the user
Create custom view that inherits LoginView
from rest_auth.registration.views import LoginView
...
class LoginViewCustom(LoginView):
authentication_classes = (TokenAuthentication,)
def post(self, request, *args, **kwargs):
response = super().post(request, *args, **kwargs)
user_serializer_data = UserSerializer(self.user, context={'request': request})
aaa = {'user': user_serializer_data.data}
aaa.update(response.data)
return Response(aaa)
Ohh, thanks! That works for me.
It's working fine. Great work. @mateoKutnjak
Hello,
how can I customize the response of the login view so that it returns the token and also the id of the logged in user?