Reputation: 3625
I'm using django rest framework. These are my settings for REST FRAMEWORK,
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
)
# 'DEFAULT_PERMISSION_CLASSES': (
# 'rest_framework.permissions.IsAuthenticated',
# ),
}
When I post to a simple endpoint, I get the following error,
{
"detail": "Authentication credentials were not provided."
}
What am I doing wrong here. Any help appreciated.
Upvotes: 0
Views: 1310
Reputation: 15748
You are doing the POST
request while your default permission class (IsAuthenticatedOrReadOnly) is set to allow only unauthorized requests for GET
, HEAD
and OPTIONS
Upvotes: 2