Учетные данные для аутентификации не были указаны в Django - PullRequest
0 голосов
/ 29 мая 2020

</p>

<pre><code>headers = {

    "content-type": "application/json",
    "Authorization": "JWT " + token,
}

post_data = json.dumps({"content": "Some Random Content"})
posted_response = requests.post(ENDPOINT, data=post_data, headers=headers)
print(posted_response.text)
</code>

Получение этой ошибки


    {"detail":"Authentication credentials were not provided."}

Разрешения и аутентификация


    REST_FRAMEWORK = {
        'DEFAULT_AUTHENTICATION_CLASSE': (
            'rest_framework.authentication.BasicAuthentication',
            'rest_framework.authentication.SessionAuthentication',
            'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
        ),
        'DEFAULT_PERMISSION_CLASSES': (
            'rest_framework.permissions.IsAuthenticated',
        )
    }

...