--- id: django-ninja-jwt version: "5.4.5" license: unclear license_treatment: permissive maintenance: active --- # django-ninja-jwt — Django Ninja JWT - JSON Web Token for Django-Ninja License: permissive · Maintenance: active · Downloads: 237.4K/mo ## 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 above — 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 pip install django-ninja-jwt uv add django-ninja-jwt poetry add django-ninja-jwt ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 237.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags jwt authentication django ninja, django ninja token auth, json web token django, jwt refresh token django, django api authentication, bearer token django ninja, django ninja access control, jwt-auth, django-ninja, rest-api [View on SkillFed](https://skillfed.io/packages/django-ninja-jwt) · [View on PyPI](https://pypi.org/project/django-ninja-jwt/)