【发布时间】:2018-08-04 23:35:29
【问题描述】:
我正在使用 django rest 框架进行身份验证。
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication'
),
但在我的注册函数中:
class UserRegister(APIView):
@staticmethod
def post(request, user_name):
.
.
.
.
.
显然我不需要令牌,但是我收到错误:
"detail": "Authentication credentials were not provided."
我尝试了这个可能的答案: this answer
但我遇到了这个错误:
'staticmethod' object has no attribute '__name__'
通过删除@staticmethod 装饰器,我又遇到了之前的错误:
"detail": "Authentication credentials were not provided."
如何排除这个特殊功能需要token?
tnx
【问题讨论】:
标签: django django-rest-framework