authentication.py 343 Bytes
Newer Older
1 2 3 4 5 6 7 8
from rest_framework.authentication import SessionAuthentication, BasicAuthentication 

# cf <https://stackoverflow.com/questions/30871033/django-rest-framework-remove-csrf>
class CsrfExemptSessionAuthentication(SessionAuthentication):

    def enforce_csrf(self, request):
        return  # To not perform the csrf check previously happening