user_management/api/authentication.py
def authenticate(self, request):
        """
        Authenticate a user from a token form field

        Errors thrown here will be swallowed by django-rest-framework, and it
        expects us to return None if authentication fails.
        """
        try:
            key = request.data['token']
        except KeyError:
            return

        try:
            token = AuthToken.objects.get(key=key)
        except AuthToken.DoesNotExist:
            return

        return (token.user, token)
def authenticate(self, request):
        """
        Authenticate a user from a token form field

        Errors thrown here will be swallowed by django-rest-framework, and it
        expects us to return None if authentication fails.
        """
        try:
            key = request.data['token']
        except KeyError:
            return

        try:
            token = AuthToken.objects.get(key=key)
        except AuthToken.DoesNotExist:
            return

        return (token.user, token)
Authenticate a user from a token form field

        Errors thrown here will be swallowed by django-rest-framework, and it
        expects us to return None if authentication fails.