Library to give vanilla Django jwt auth.
Project description
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...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dj-jwt-0.0.2.tar.gz
.
File metadata
- Download URL: dj-jwt-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de89e14a6a287823cb4e853f6724f1580b2a66a3a988936b23aa22f06e8d2a36 |
|
MD5 | f1c03c9095b5e766dc9255a002fe3c20 |
|
BLAKE2b-256 | adb4eea456dd32ec0ce369e87e3aa1c7f257114e75d7c55bdb1dcf4534030e9d |
Provenance
File details
Details for the file dj_jwt-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: dj_jwt-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 658d9d13284c34d7c4c127f29467e59f014d342567e8b88fd7d1f57dde0e15ea |
|
MD5 | 0a4e1f125f7d05de01ef880ef030ca8e |
|
BLAKE2b-256 | 0f909d49efae0f98bc6287ec277e4b7c671e63a105a6fc797d3a61ea85701b90 |