0

I've deployed a project on Elastic Beanstalk and I can't figure out why Django Rest Framework returns this response:

Authentication credentials were not provided.

when I go to ../api/article

I'm sending header - Authorization: Token

curl -X GET http://environment.eba-etpcqsqk.us-west-1.elasticbeanstalk.com/api/article/ -H 'Authorization: Token MYTOKEN'

{"detail":"Authentication credentials were not provided."}

Views:

class ArticleViewSet(ModelViewSet):
    queryset = Article.objects.all()
    serializer_class = ArticleSerializer
    pagination_class = StandardResultsSetPagination
    filterset_class = ArticleFilter

    # user must be either logged in or must provide AUTH TOKEN
    authentication_classes = [TokenAuthentication, SessionAuthentication]
    permission_classes = [IsAuthenticated]

I've DEBUG=True and it works on the development server. Do you know where is the problem? Maybe EBS doesn't forward Headers?

Milano
  • 13,773
  • 29
  • 96
  • 240
  • I bet you have to explitily allow it to ... I know i had to do that with the cloudfront stuff ... aws is awesome and all ... but getting it setup can be a real pain in the ass – Joran Beasley Sep 02 '20 at 20:56
  • @JoranBeasley Yes, that was the problem. Thanks – Milano Sep 02 '20 at 21:04

0 Answers0