【发布时间】:2021-06-15 04:21:13
【问题描述】:
我正在使用 django allauth 进行身份验证
这是我的settings.py
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
],
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated'
],
}
已安装的应用程序如下:
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
'rest_auth.registration',
'allauth',
'allauth.account',
我正在尝试这样的方式:
curl -X POST "http://127.0.0.1:8000/api/v1/cinema-hall/" -H 'Authorization: Token 44eba1cdb1ecde6d3a55d6c85d7c4f44315f2c44'
我得到这个错误:
{"detail":"Authentication credentials were not provided."}
我看到很多类似的帖子是这样的:Django Rest Framework Authentication credentials were not provided
但这些都没有解决我的问题。
谁能告诉我遇到此错误的可能原因是什么?
【问题讨论】:
标签: django django-rest-framework django-allauth