9
9
95506682020-09-24 17:19:57
Django
9550668, 2020-09-24 17:19:57

How to disable Unauthorized response from DRF?

Good day to all.

I have a class that inherits generics.ListAPIView.
Inside the class, I changed permission_classes = [IsAuthenticatedOrReadOnly]

When a request is sent with a token in the header, I get a 401 error, if I don’t pass the token in the header, I get the information that the class should give out.

How to make it so that when permission_classes = [IsAuthenticatedOrReadOnly] Exception is not raised even when passing an invalid token?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-09-24
@bacon

And why then is IsAuthenticatedOrReadOnly needed here? Set AllowAny.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question