Skip to main content

drf-jwt

JSON Web Token based authentication using Django REST Framework, the JWT encoded in base64 is put in the headers:

Authorization: Bearer <token>

install:

pip install django-rest-jwt

let JWT do the authentification:

add 'drf_jwt.authentication.JSONWebTokenAuthentication' in authentication classes:

'DEFAULT_AUTHENTICATION_CLASSES': [
    'drf_jwt.authentication.JSONWebTokenAuthentication',
]

make endpoints to login and get the JWT:

from drf_jwt.controllers import Auth

urlpatterns = [
    path('api/login', Auth.as_view()),
]

suport GET and POST

POST:

{ login, password }

login will be the username of the authenticate function of django

GET:

return a JWT token if you are authenticate

so, one could do a Basic Authentication to the GET endpoints to receve a JWT

Metadata

Release files for django-rest-jwt 0.1.46

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

Built distribution (wheel)

Table of built distributions (wheels) for django-rest-jwt 0.1.46
File Interpreter ABI Platform Actions
django_rest_jwt-0.1.46-py3-none-any.whl Python 3 none any Details for django_rest_jwt-0.1.46-py3-none-any.whl

Release files / django_rest_jwt-0.1.46-py3-none-any.whl

Download URL django_rest_jwt-0.1.46-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca071dbf9a105686efc06a25202873fda9eedc1905f1c7653a1f185b1ad31120
BLAKE2b-256 checksum
How to use checksums
1d8c8ed4d67a13ecd2515d7276e38960c59ec00a36eb30ebcc0513e1c327be8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

Security for django-rest-jwt 0.1.46

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.

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