aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken/views.py
diff options
context:
space:
mode:
authorPavel Savchenko2012-11-28 17:04:36 +0200
committerPavel Savchenko2012-11-28 17:04:36 +0200
commit7eec582d406b9b366f9d364b53d1fc509831d9b4 (patch)
treefc4fa45015c6970358018caa0cce892fc24e3fb9 /rest_framework/authtoken/views.py
parent11ef60b127d38341874989a40500fe3c61771d28 (diff)
downloaddjango-rest-framework-7eec582d406b9b366f9d364b53d1fc509831d9b4.tar.bz2
Better to return 401 when failing to authenticate
Diffstat (limited to 'rest_framework/authtoken/views.py')
-rw-r--r--rest_framework/authtoken/views.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rest_framework/authtoken/views.py b/rest_framework/authtoken/views.py
index 3ac674e2..cfaacbe9 100644
--- a/rest_framework/authtoken/views.py
+++ b/rest_framework/authtoken/views.py
@@ -18,7 +18,7 @@ class ObtainAuthToken(APIView):
if serializer.is_valid():
token, created = Token.objects.get_or_create(user=serializer.object['user'])
return Response({'token': token.key})
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ return Response(serializer.errors, status=status.HTTP_401_UNAUTHORIZED)
obtain_auth_token = ObtainAuthToken.as_view()