class ExampleAuthentication(authentication.BaseAuthentication):

    def authenticate(self, request):
        username = request.META.get('X_USERNAME')
if not username:
    return None
Django Rest Framework custom authentication