Skip to main content

dj-jwt

Dj-JWT is a JSON Web Token authentication plugin for vanilla django built on Simple JWT. This is a thin layer on Simple JWT, it should not need to be updated too regularly.

Acknowledgments

Simple JWT is a great jwt library, and is updated regulary. However, it is based soley for rest framework. This library is a thin layer on top of that which uses Simple JWT, but lets you use it with vanilla django.

Getting Started

Install

dj-jwt can be installed with pip:

pip install dj-jwt

Add 'djjwt' to your INSTALLED_APPS setting.

INSTALLED_APPS = [
    ...
    'djjwt',
]

If you are wanting to use the urls built in just add the following your projects urls.py

path("token/", include(("djjwt.urls", "djjwt"), namespace="dj-jwt"))

Add the middleware to your middleware

MIDDLEWARE = [
    ...
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "djjwt.middleware.DjangoJWTAuthentication",
]

URL Usage

/token/authenticate/
/token/refresh/
/token/verify/
from django.urls import reverse_lazy

reverse_lazy('jwt-token:authenticate')
reverse_lazy('jwt-token:refresh')
reverse_lazy('jwt-token:verify')

Commands

You can create an access and refresh token on the command line to make testing easier.

./manage.py create_tokens --userid=2
./manage.py create_tokens --email=buddy@example.com
./manage.py create_tokens    # Grabs the first user in the system

Example output

Tokens for: Buddy Lindsey <buddy@example.com>
Access Token:  eyJ0...
Refresh Token: eyJ0...

Metadata

Release files for dj-jwt 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-jwt 0.0.2
File Size Uploaded Provenance
dj-jwt-0.0.2.tar.gz 3.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dj-jwt 0.0.2
File Interpreter ABI Platform
dj_jwt-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / dj-jwt-0.0.2.tar.gz

Download URL dj-jwt-0.0.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
de89e14a6a287823cb4e853f6724f1580b2a66a3a988936b23aa22f06e8d2a36
BLAKE2b-256 checksum
How to use checksums
adb4eea456dd32ec0ce369e87e3aa1c7f257114e75d7c55bdb1dcf4534030e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.4

Release files / dj_jwt-0.0.2-py3-none-any.whl

Download URL dj_jwt-0.0.2-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
658d9d13284c34d7c4c127f29467e59f014d342567e8b88fd7d1f57dde0e15ea
BLAKE2b-256 checksum
How to use checksums
0f909d49efae0f98bc6287ec277e4b7c671e63a105a6fc797d3a61ea85701b90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.4

Security for dj-jwt 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page