[Fixed]-How to add authentication token in header of `APIClient` in `django rest_framework test`

26👍

Since you are using Authorization: Bearer in curl, you should also use client.credentials with Bearer word instead of Token:

client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.access_token)

Leave a comment