Object of type 'AuthToken' is not JSON serializable

Better way is use this method in python

_, token = AuthToken.objects.create(user)
return Response({
    "user": UserSerializer(user, context=self.get_serializer_context()).data,
    "token": token
})

The Token.objects.create returns a tuple (instance, token). So in order to get token use the index 1

"token": AuthToken.objects.create(user)[1]


This particular error occurs because the Token.objects.create returns a tuple (instance, token). just use the second position [1] by using instead of former

"token": AuthToken.objects.create(user)[1]