angularjs - Django REST Angular $http 403 Status -
so have simple api endpoint supposed determine if user logged in. did decide make post
request sake of hiding response being accessed in browser
class check(apiview): def post(self, request): print request.user if request.user.is_authenticated(): # successful response logged in return response(status = http_200_ok) # return error status code not logged in return response(status = http_401_unauthorized)
when logged out, anonymoususer
in console , 401 status code expected. when logged in superuser or other user, no print output , 403 status code. indicates reason entire callback never entered. i've been told issue of permissions have allowany
enabled. guys have ideas?
rest_framework = { 'default_renderer_classes': [ 'rest_framework.renderers.jsonrenderer' ], 'default_parser_classes': [ 'rest_framework.parsers.jsonparser' ], 'default_authentication_classes': [ 'rest_framework.authentication.sessionauthentication', 'rest_framework.authentication.basicauthentication' ], 'default_permission_classes': [ 'rest_framework.permissions.allowany', ] }
Comments
Post a Comment