mozilla/mozilla-django-oidc

Doesn't work with `djangorestframework-simplejwt`

dolphingarlic opened this issue · 0 comments

Hi there. I have a website that uses both OIDC and JWT authentication. I thought of using this and the djangorestframework-simplejwt packages together to achieve this, but they don't seem to play well together. One of the authentication methods doesn't work, depending on how I order the authentication classes in settings.py.

Here are my REST framework settings in settings.py:

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'mozilla_django_oidc.contrib.drf.OIDCAuthentication',
        'rest_framework_simplejwt.authentication.JWTAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.BasicAuthentication',
    ),
    'DATE_FORMAT': '%b %d %Y',
}

Is there any way to fix this?