简体   繁体   English

未提供身份验证凭据。部署到AWS时

[英]Authentication credentials were not provided. when deployed to AWS

I created some APIs on the Django project using Django rest framework. 我使用Django rest框架在Django项目上创建了一些API。 I set IsAdminUser to permission classes. 我将IsAdminUser设置为权限类。

When I run the project locally and make a request to it with auth info, it works. 当我在本地运行项目并使用auth信息向它发出请求时,它可以工作。

I deployed it to AWS server by using Elastic Beanstalk and make a request, and it returns error 403 我使用Elastic Beanstalk将其部署到AWS服务器并发出请求,并返回错误403

Authentication credentials were not provided

Here is my API 这是我的API

class HamListApiView(ListAPIView):
    queryset = Ham.objects.all()
    serializer_class = HamSerializer
    permission_classes = [permissions.IsAdminUser]

What am I missing here? 我在这里错过了什么?

My guess is that the server does not allow authorization header. 我的猜测是服务器不允许授权标头。

Usual issue with aws beanstalk aws beanstalk的常见问题

Try to add this to your container commands: 尝试将此添加到容器命令:

 01_wsgipass:
     command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'

暂无
暂无

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

相关问题 DRF:“详细信息”:“未提供身份验证凭据。” - DRF: “detail”: “Authentication credentials were not provided.” Django:“详细信息”:“未提供身份验证凭据。” - Django : “detail”: “Authentication credentials were not provided.” Django OAuth 工具包 - 自省请求:“未提供身份验证凭据。” - Django OAuth Toolkit - Introspection Request: “Authentication credentials were not provided.” "detail": "未提供身份验证凭据。" 一般视图 - "detail": "Authentication credentials were not provided." for general views Django Rest Framework JWT“未提供身份验证凭据。”} - Django Rest Framework JWT “Authentication credentials were not provided.”} Django Rest Framework {“detail”:“未提供身份验证凭据。”} - Django Rest Framework {“detail”:“Authentication credentials were not provided.”} 自定义Django休息框架身份验证响应{“详细信息”:“未提供身份验证凭据。”} - Customize Django rest framework authentication response {“detail”: “Authentication credentials were not provided.”} "detail": "未提供身份验证凭据。" Django-rest-frameweork 和 React - "detail": "Authentication credentials were not provided." Django-rest-frameweork and React Django-rest-framework {“详细信息”:“未提供身份验证凭据。” } 使用 django-rest-knox - Django-rest-framework {“detail”: “Authentication credentials were not provided.” } using django-rest-knox django rest API开发使用Swagger UI,有“详细信息”:“未提供身份验证凭据。” - django rest API development Using Swagger UI, got“detail”: “Authentication credentials were not provided.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM