from django.contrib.auth.models import User
from rest_framework import authentication
from rest_framework import exceptions
This example authentication is straight from the official docs here.
class ExampleAuthentication(BaseAuthentication):
def authenticate(self, request):
usernam...