mozilla / mozilla-django-oidc

A django OpenID Connect library
https://mozilla-django-oidc.readthedocs.io
Mozilla Public License 2.0
449 stars 168 forks source link

Doesn't work with `djangorestframework-simplejwt` #449

Open dolphingarlic opened 2 years ago

dolphingarlic commented 2 years ago

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?