简体   繁体   English

详细信息:未提供身份验证凭据

[英]details:Authentication credentials were not provided

I am able to authenticate my users to get the token but when i try to view all my users, i get the error {"detail":"Authentication credentials were not provided."} . 我能够对我的用户进行身份验证以获得令牌,但是当我尝试查看所有用户时,出现错误{"detail":"Authentication credentials were not provided."} I have had a look at other related issues and solutions but i am still not getting it working. 我看过其他相关问题和解决方案,但仍然无法正常工作。 What am i not doing right to solve this issue to view all my users without getting this error 我没有正确地解决此问题以查看我的所有用户而没有得到此错误的正确方法

settings 设置

REST_FRAMEWORK = { 
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.TokenAuthentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    )
}

views.py views.py

class UserList(generics.ListCreateAPIView):
    queryset = User.objects.all()
    serializer_class = UserSerializer

httpd.conf httpd.conf文件

Alias /bitnami/ "/Applications/XAMPP/xamppfiles/apache2/htdocs/"
Alias /bitnami "/Applications/XAMPP/xamppfiles/apache2/htdocs"

    <Directory "/Applications/XAMPP/xamppfiles/apache2/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    WSGIPassAuthorization On

postman image 邮递员形象 在此处输入图片说明

update your settings.py file to support some additional rest_framework classes - 更新您的settings.py文件以支持其他一些rest_framework类-

 REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.IsAdminUser',
        'rest_framework.permissions.IsAuthenticated',
    ],
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.TokenAuthentication',
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework.authentication.SessionAuthentication'

    )
}

Let me know, if it helps! 让我知道,如果有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取:未提供身份验证凭据 - Fetch : authentication credentials were not provided Django:未提供身份验证凭据 - Django: Authentication credentials were not provided DRF:“详细信息”:“未提供身份验证凭据。” - DRF: “detail”: “Authentication credentials were not provided.” Django:“详细信息”:“未提供身份验证凭据。” - Django : “detail”: “Authentication credentials were not provided.” 使用用户名和密码登录时未提供身份验证凭据 - Authentication credentials were not provided on login with username and password Django Rest 框架 - 未提供身份验证凭据 - Django Rest Framework - Authentication credentials were not provided PlotlyRequestError:未提供身份验证凭据 python - PlotlyRequestError: Authentication credentials were not provided python Django OAuth Toolkit为我提供了“未提供身份验证凭据”错误 - Django OAuth Toolkit giving me “Authentication credentials were not provided” error Django OAuth 工具包 - 自省请求:“未提供身份验证凭据。” - Django OAuth Toolkit - Introspection Request: “Authentication credentials were not provided.” Django restframework,未提供身份验证凭据,knox-tokenauthentication - Django restframework, Authentication credentials were not provided, knox-tokenauthentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM