Bigair
Bigair

Reputation: 1592

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?

Upvotes: 5

Views: 933

Answers (1)

Enthusiast Martin
Enthusiast Martin

Reputation: 3091

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'

Upvotes: 13

Related Questions