[英]Django : “detail”: “Authentication credentials were not provided.”
I'm using django rest framework. 我正在使用django rest框架。 These are my settings for REST FRAMEWORK,
这些是我对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.
任何帮助表示赞赏。
您正在执行POST
请求,同时将默认权限类( IsAuthenticatedOrReadOnly )设置为仅允许未经授权的GET
, HEAD
和OPTIONS
请求
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.