Using token to get username

I have coded the API to work with my web and also generate token upon login/register from the Postman request by using knox for the token. Now I want to make use of this token that is linked to the account that is logged in to get the username so I can know which account made the request. But I am not sure on how to use this token. Can anyone provide me with some advise on how to do this? Thanks !

def create_job(request):
    job = Job()
    jobserializer = JobSerializers(job, data =
    if jobserializer.is_valid():
        operation =
        data = {}
        if operation:
            data["Success"] = "Successfully created"
        return Response(data)
    return Response(jobserializer.errors, status=status.HTTP_400_BAD_REQUEST)

class JobSerializers(serializers.ModelSerializer):
    class Meta:
        model = Job
        fields = ['combinedparameters', 'servicedate', 'owner']

class Job(models.Model):
    owner = models.CharField(max_length = 150)    
    datetime = models.DateTimeField(
    combinedparameters = models.CharField(max_length = 1000)
    servicedate = models.CharField(max_length=10)
    def __str__(self):
            return self.servicedate

In the web browser, I get the user by request.user but I am not sure on how to make use of this token to get the user that is logged-in in API.

I’m guessing you’ve already tried to access request.user and it doesn’t work here?

Actually, your view has access to request.user because AuthenticationMiddleware adds the user to the request object if there’s a valid session associated with that request. (The browser has nothing to do with it.)