Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authentication credentials were not provided. when deployed to AWS

I created some APIs on the Django project using Django rest framework. I set IsAdminUser to permission classes.

When I run the project locally and make a request to it with auth info, it works.

I deployed it to AWS server by using Elastic Beanstalk and make a request, and it returns error 403

Authentication credentials were not provided

Here is my API

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

What am I missing here?

like image 786
Bigair Avatar asked Sep 21 '18 06:09

Bigair


1 Answers

My guess is that the server does not allow authorization header.

Usual issue with aws beanstalk

Try to add this to your container commands:

 01_wsgipass:
     command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'
like image 79
Enthusiast Martin Avatar answered Nov 05 '22 22:11

Enthusiast Martin