{"library":"mozilla-django-oidc","title":"Mozilla Django OIDC","description":"mozilla-django-oidc is a lightweight authentication and access management library for integrating Django applications with OpenID Connect enabled authentication services. It is actively maintained with frequent updates, currently at version 5.0.2, and typically releases new versions to support new Django and Python versions.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install mozilla-django-oidc"],"cli":null},"imports":["from mozilla_django_oidc.auth import OIDCAuthenticationBackend","from mozilla_django_oidc.views import OIDCAuthenticationRequestView","from mozilla_django_oidc import urls"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# settings.py\nimport os\n\nINSTALLED_APPS = [\n    # ...\n    'django.contrib.auth',\n    'mozilla_django_oidc',\n    # ...\n]\n\nAUTHENTICATION_BACKENDS = (\n    'mozilla_django_oidc.auth.OIDCAuthenticationBackend',\n    'django.contrib.auth.backends.ModelBackend',\n)\n\n# OpenID Connect Provider (OP) settings - REQUIRED\nOIDC_OP_AUTHORIZATION_ENDPOINT = os.environ.get('OIDC_OP_AUTHORIZATION_ENDPOINT', 'https://your-op.com/auth')\nOIDC_OP_TOKEN_ENDPOINT = os.environ.get('OIDC_OP_TOKEN_ENDPOINT', 'https://your-op.com/token')\nOIDC_OP_USER_ENDPOINT = os.environ.get('OIDC_OP_USER_ENDPOINT', 'https://your-op.com/userinfo')\nOIDC_OP_JWKS_ENDPOINT = os.environ.get('OIDC_OP_JWKS_ENDPOINT', 'https://your-op.com/jwks')\n\n# Relying Party (RP) / Client settings - REQUIRED\nOIDC_RP_CLIENT_ID = os.environ.get('OIDC_RP_CLIENT_ID', 'your-client-id')\nOIDC_RP_CLIENT_SECRET = os.environ.get('OIDC_RP_CLIENT_SECRET', 'your-client-secret')\n\n# Optional settings for redirection after login/logout\nLOGIN_REDIRECT_URL = '/'\nLOGOUT_REDIRECT_URL = '/'\n\n# urls.py (in your project's root urls.py)\nfrom django.contrib import admin\nfrom django.urls import path, include\n\nurlpatterns = [\n    path('admin/', admin.site.urls),\n    path('oidc/', include('mozilla_django_oidc.urls')),\n    # Your other app URLs\n    path('', lambda request: HttpResponse(\"Welcome! <a href='/oidc/authenticate/'>Login</a> or <a href='/oidc/logout/'>Logout</a>\"), name='home'),\n]\n\n# In a simple template (e.g., base.html) add login/logout links:\n# {% if user.is_authenticated %}\n#   <p>Hello, {{ user.username }}!</p>\n#   <a href=\"{% url 'oidc_logout' %}\">Log Out</a>\n# {% else %}\n#   <a href=\"{% url 'oidc_authentication_init' %}\">Log In with OIDC</a>\n# {% endif %}\n","lang":"python","description":"This quickstart outlines the essential `settings.py` and `urls.py` configurations. You must add `mozilla_django_oidc` to `INSTALLED_APPS` and include its `OIDCAuthenticationBackend` in `AUTHENTICATION_BACKENDS`. Critical OIDC provider (OP) and relying party (RP) details (`OIDC_OP_*`, `OIDC_RP_CLIENT_ID`, `OIDC_RP_CLIENT_SECRET`) must be provided, ideally via environment variables for security. The library's URLs are included via `path('oidc/', include('mozilla_django_oidc.urls'))`. Basic login and logout links can then be added to your templates.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"4.0.1","pypi_latest":"5.0.2","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":4.9,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"86.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5,"import_time_s":null,"mem_mb":null,"disk_size":"87M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"91.5M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.8,"import_time_s":null,"mem_mb":null,"disk_size":"92M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"82.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.4,"import_time_s":null,"mem_mb":null,"disk_size":"83M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"82.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":4.4,"import_time_s":null,"mem_mb":null,"disk_size":"83M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"84.8M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"mozilla-django-oidc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.8,"import_time_s":null,"mem_mb":null,"disk_size":"85M"}]}}