skillfed

edx-drf-extensions

edX extensions of Django REST Framework

edx-drf-extensions v10.6.0 89.4K downloads/30d#13,662 on PyPI18
Permissive license Apache 2.0 Active released

What it is and what it does

edx-drf-extensions is a library of shared API utilities built on top of Django and djangorestframework, providing JWT authentication, CSRF token endpoints, and cross-cutting concerns for multiple applications. It handles JWT cookie validation with fallback to session authentication, email matching verification between JWT and user records, and exposes a CSRF API endpoint for frontend applications making state-changing requests to Django services with CSRF middleware enabled.

The library depends on Django, djangorestframework, drf-jwt, pyjwt, django-waffle, edx-django-utils, edx-opaque-keys, requests, and semantic_version. It is actively maintained with a stable release history since 2016, recent releases adding support for Django 5.2 and Python 3.12, and dropping support for older versions. The codebase includes detailed changelog documentation of breaking changes and feature toggles for gradual rollout.

Use it for:

  • Add JWT authentication to a Django REST API service that validates tokens from an identity provider.
  • Expose a CSRF token endpoint in a Django service for frontend applications to retrieve tokens for state-changing requests.
  • Implement forgiving JWT cookie authentication that falls back to session authentication when JWT validation fails.
  • Verify that JWT user identity matches the session user identity to prevent authentication bypass in multi-service deployments.
  • Enable email matching validation between JWT claims and user records in LMS services.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides JWT authentication, CSRF token endpoints, and cross-cutting API concerns for Django REST Framework applications.

Yes, if you are building a Django REST API that needs JWT authentication and CSRF token handling integrated with the Open edX ecosystem. The library is actively maintained, has no known vulnerabilities, and provides well-documented authentication utilities. No, if you are building a standalone Django REST API unrelated to Open edX—the package may be tightly coupled to Open edX conventions.

Install

edx-drf-extensions on PyPI

pip

pip install edx-drf-extensions

uv

uv add edx-drf-extensions

poetry

poetry add edx-drf-extensions

Installing edx-drf-extensions

Before you install

Low friction installation with a pure-Python wheel. Actively maintained with recent Django 5.2 support added in version 10.6.0 (released 2025-04-04). Nine runtime dependencies are all standard Django and authentication libraries.

License in practice

Apache 2.0 permissive license allows commercial and private use with minimal restrictions. No copyleft obligations or proprietary concerns.

Quickstart

pip install edx-drf-extensions

from djangorestframework import serializers
from Django import middleware

# Add to Django MIDDLEWARE and INSTALLED_APPS
MIDDLEWARE = [..., 'JwtAuthCookieMiddleware']
INSTALLED_APPS = [..., 'csrf.apps.CsrfAppConfig']

Requires Django 4.2 or later and Python 3.11 or later (dropped support for earlier versions in recent releases).

Verify before relying

  • Whether the package is suitable for non-Open edX Django projects or is tightly coupled to Open edX infrastructure.
  • Performance impact of email matching check when ENABLE_JWT_AND_LMS_USER_EMAIL_MATCH toggle is enabled.
  • Specific JWT signature verification behavior and fallback scenarios in cookie validation.

Package facts

License Apache 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 9 — Django, django-waffle, djangorestframework, drf-jwt, edx-django-utils, edx-opaque-keys, pyjwt, requests, semantic_version
Maintenance actively maintained — 497 days since the last release
Last repo commit
First released
Downloads 89,391/month — #13,662 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: edx_drf_extensions-10.6.0-py2.py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11

Tags

django rest framework jwt authenticationcsrf token endpoint djangodrf jwt middlewaredjango api extensionsjwt cookie authentication
jwt-authdjango-rest-framework

More WWW/HTTP packages