Django Rest Framework - Authentication credentials were not provided
Solution 1:
If you are running Django on Apache using mod_wsgi you have to add
WSGIPassAuthorization On
in your httpd.conf
. Otherwise, the authorization header will be stripped out by mod_wsgi
.
Solution 2:
Solved by adding "DEFAULT_AUTHENTICATION_CLASSES" to my settings.py
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAdminUser'
),
}