Open radix opened 4 years ago
To work around this I subclass JSONWebTokenAuthentication
and override authenticate
to do this:
def authenticate(self, request):
if request.environ.get('HTTP_AUTHORIZATION', '').startswith('JWT'): # Note I override prefix from Bearer to JWT
return super().authenticate(request)
I am experiencing the same when trying to use an email confirmation link to create an account.
One would expect the Authentication to fall-through, and try other authentication methods, the same as it did in the original repository.
Or am I missing something?
When the
Authorization
header is sent with a prefix other than the configured one (defaultBearer
, though I override it to beJWT
in my app), drf-jwt raises an AuthenticationFailed. This means that authentication is completely stopped and other auth plugins don't get a chance to run.My app uses both drf-jwt and DRF Token authentication, so when I switched from the old djangorestframework-jwt to this, my DRF Token authentication stopped working. The old djangorestframework-jwt properly returned None instead of raising AuthenticationFailed when the prefix wasn't one it expected.