[英]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.