every time I do a PUT request with a JWT token included in the header I am getting the following response even though the correct PREFIX is included in the authorisation header
{ "username": [ "This field is required." ], "password": [ "This field is required." ] }
the token generation, refresh,verify urls are working fine, but I can't update any user details for some reason,
here is my views.py
class UserDetail(APIView):
permission_classes = (IsOwner,IsAuthenticated,)
"""
Retrieve, update or delete a user instance.
"""
def get_object(self, pk):
try:
return User.objects.get(pk=pk)
except User.DoesNotExist:
raise Http404
def get(self, request, pk, format=None):
user = self.get_object(pk)
serializer = UserSerializer(user)
return Response(serializer.data)
def put(self, request, pk, format=None):
authenication_classes = (JSONWebTokenAuthentication)
user = self.get_object(pk)
serializer = UserSerializer(user, data=request.data)
if serializer.is_valid():
serializer.save()
user = Profile.objects.get(id=pk)
user.profile.updated = timezone.now()
user.save()
return Response(serializer.data, status=status.HTTP_200_OK)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def delete(self, request, pk, format=None):
user = self.get_object(pk)
user.delete()
return Response(status=status.HTTP_204_NO_CONTENT)
every time I do a PUT request with a JWT token included in the header I am getting the following response even though the correct PREFIX is included in the authorisation header
{ "username": [ "This field is required." ], "password": [ "This field is required." ] }
the token generation, refresh,verify urls are working fine, but I can't update any user details for some reason, here is my views.py