For DRF, it is better to use the SessionAuthentication
from rest_framework.authentication import SessionAuthentication
class ApproveOrDeclineUserView(APIView):
authetication_classes = (SessionAuthentication, )
Or use directly for whole endpoints:
# In your DRF settings
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
]
}
And don't forget to remove decorator - @method_decorator