django-ninja-jwt
Django Ninja JWT - JSON Web Token for Django-Ninja
What it is and what it does
Django-Ninja-JWT is a JWT authentication plugin for Django-Ninja that provides token-based authentication without the Django REST Framework dependency. It is a fork of Simple JWT adapted to work with Django-Ninja's native API framework, offering three core endpoints: token pair generation (access and refresh tokens), token refresh, and token verification. The library handles the cryptographic signing and validation of JWTs using pyjwt, and integrates with Django's user authentication system.
You register a controller to your NinjaExtraAPI instance to expose these endpoints, then use the returned access tokens in Authorization headers to protect views. Refresh tokens allow clients to obtain new access tokens without re-authenticating. The package supports customization by subclassing its controller classes, and can be localized by adding it to INSTALLED_APPS. It maintains compatibility with modern Python versions and recent Django releases.
Use it for:
- Build stateless REST APIs with Django-Ninja that issue short-lived access tokens and longer-lived refresh tokens for client authentication.
- Protect Django-Ninja endpoints by requiring Bearer token validation without adding Django REST Framework to your project.
- Implement token refresh workflows where clients exchange expired access tokens for new ones using a refresh token.
- Customize token claims and validation logic by subclassing controller classes for domain-specific requirements.
- Add JWT support to existing Django-Ninja projects that need standard token-based authentication.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides JWT authentication for Django-Ninja APIs, offering token generation, refresh, and verification endpoints without requiring Django REST Framework.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and fills a clear gap for Django-Ninja users who need JWT authentication without Django REST Framework. The permissive MIT license poses no restriction. Install if you are building a Django-Ninja API that requires token-based authentication.
Install
django-ninja-jwt on PyPI
pip
pip install django-ninja-jwtuv
uv add django-ninja-jwtpoetry
poetry add django-ninja-jwtInstalling django-ninja-jwt
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained as of 24 days ago with recent commits and a stable dependency chain anchored on Django and pyjwt.
License in practice
MIT-licensed under permissive terms, allowing unrestricted use, modification, and distribution in commercial and private projects.
Quickstart
pip install django-ninja-jwt
from django_ninja_jwt.controller import NinjaJWTDefaultController
from django_ninja_extra import NinjaExtraAPI
api = NinjaExtraAPI()
api.register_controllers(NinjaJWTDefaultController)
Requires Django >= 2.1, Django-Ninja >= 0.16.1, and django-ninja-extra >= 0.14.2; must use NinjaExtraAPI rather than plain Django-Ninja Router for default controller registration.
Verify before relying
- Whether token claims customization covers all common use cases (user roles, permissions, custom fields).
- Performance characteristics under high token generation or validation load.
- Compatibility with async Django views and whether refresh/verify endpoints support async handlers.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — Django, pyjwt, pydantic-settings, django-ninja-extra |
| Maintenance | actively maintained — 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 237,436/month — #8,959 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_ninja_jwt-5.4.5-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
django-ninja-extraDjango Ninja Extra extends Django Ninja with…
permissive · top 15,000 on PyPI
djangorestframework-simplejwtProvides JSON Web Token (JWT) authentication…
permissive · top 5,000 on PyPI
django-ninjaDjango Ninja builds type-hint-based REST APIs…
permissive · top 5,000 on PyPI
Flask-JWT-ExtendedAdds JSON Web Token (JWT) authentication to…
permissive · top 5,000 on PyPI
drf-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
dj-rest-authProvides drop-in REST API endpoints for user…
permissive · top 5,000 on PyPI
zi-api-auth-clientGenerates JWT tokens for ZoomInfo…
permissive · top 15,000 on PyPI
myjwtA command-line tool for testing and…
permissive · top 15,000 on PyPI
django-graphql-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
djangorestframework-jwtAdds JSON Web Token (JWT) authentication…
permissive · top 15,000 on PyPI