I am using rest_framework_simplejwt
to authenticate my users but, in some views i need to ignore it, because these are public views. i want to check the token into view flow. The expected behaviour is:
In public view
- Avoid token validation: If is there an expired or invalid token, ignore it and let me in to validate it into APIView
Actually rest_framework_simplejwt
checks token and raise 401
if token is invalid or expired...
I tried disabling authentication_classes
within APIView like this:
class SpecificProductApi(APIView):
def get_authenticators(self):
if self.request.method == 'GET':
self.authentication_classes = []
return super(SpecificProductApi, self).get_authenticators()
but if i disable it before enter GET APIView
method, i can't do if reques.user.is_authenticated:
because I disabled the token :(
Exists a way to enable entering to api http method and check users manually into view? thanks