A JWT authentication to django project
Project description
Django DRF JWT
Goal of this simple package is to create a simple JWT authentication for Django apps. This should be easy to configue and easy to adapt to your needs and preferences. Package is based on PyJWT
Setup
-
Install package
pip install django-drf-mjwt
-
Add django_drf_jwt to your INSTALLED_APPS:
INSTALLED_APPS = [ # ... "django_drf_jwt", # ... ]
-
Update REST_FRAMEWORK settings:
REST_FRAMEWORK = { # ... "DEFAULT_AUTHENTICATION_CLASSES": ( "django_drf_jwt.authentication.JWTAuthentication", ) # ... }
-
Add new field in your User model and add this to your settings file
JWT_DRF = { # JWT_USER_SECRET_FIELD - MUST BE DEFINED - This must be filed in User object "JWT_USER_SECRET_FIELD": "secret", }
Available settings:
# These are default settings JWT_DRF = { "JWT_SECRET": settings.SECRET_KEY, "JWT_USER_ID_FIELD": "pk", "JWT_USER_SECRET_FIELD": None, # MUST BE DEFINED - This must be a "JWT_PAYLOAD_HANDLER": "django_drf_jwt.handlers.payload_handler", "JWT_AUTH_HEADER_PREFIX": "JWT", }
Issues
Issues and bugs be free to contact me directly
NOTE
I plan to push this package to PyPi when ready! :)
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
File details
Details for the file django-drf-mjwt-0.0.1b2.tar.gz.
File metadata
- Download URL: django-drf-mjwt-0.0.1b2.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51e9a89305159dd7107229f30dfcab5a5aaf277cab8893b5beb9c884f2d49825
|
|
| MD5 |
26ba74e51e4dd9a8fd8b4b0c8b5fde7f
|
|
| BLAKE2b-256 |
d85f2dd9448492720fbe130772d5abaac6d53e99c4d1252922096638e4ef4c3a
|