Melissa Stewart
Melissa Stewart

Reputation: 3625

Django : "detail": "Authentication credentials were not provided."

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

Answers (1)

iklinac
iklinac

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

Related Questions