Skip to main content

Django GraphQL JWT

JSON Web Token authentication for Django GraphQL.
Fantastic documentation is available at https://github.com/WeenSpace/weenspace-django-jwt.

Test Coverage Codacy Package version

Installation

Install last stable version from Pypi:

pip install weenspace-django-jwt

Add AuthenticationMiddleware middleware to your MIDDLEWARE settings:

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

Add JWTMiddleware middleware to your GRAPHENE settings:

GRAPHENE = {
    "SCHEMA": "mysite.myschema.schema",
    "MIDDLEWARE": [
        "django_jwt.middleware.JWTMiddleware",
    ],
}

Add JWTBackend backend to your AUTHENTICATION_BACKENDS:

AUTHENTICATION_BACKENDS = [
    "django_jwt.backends.JWTBackend",
    "django.contrib.auth.backends.ModelBackend",
]

Schema

Add weenspace-django-jwt mutations to the root schema:

import graphene
import django_jwt


class Mutation(graphene.ObjectType):
    create_token = django_jwt.Create.Field()
    verify_token = django_jwt.Verify.Field()
    refresh_token = django_jwt.Refresh.Field()


schema = graphene.Schema(mutation=Mutation)

Metadata

Release files for weenspace-django-jwt 1.0.1

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

Source distribution (sdist)

Source distribution for weenspace-django-jwt 1.0.1
File Size Uploaded
weenspace_django_jwt-1.0.1.tar.gz 21.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weenspace-django-jwt 1.0.1
File Interpreter ABI Platform
weenspace_django_jwt-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 69.4 kB

Release files / weenspace_django_jwt-1.0.1.tar.gz

Download URL weenspace_django_jwt-1.0.1.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d52b8c8735f23c9c29d8a9bc6f90a63c9b260239e0a0f18bf1a70f4575441366
BLAKE2b-256 checksum
How to use checksums
d96a5d93cdd512a954b7a80dd2bc5a293bcc76839809042464ce5146dd3ae46d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.2 Windows/10

Release files / weenspace_django_jwt-1.0.1-py3-none-any.whl

Download URL weenspace_django_jwt-1.0.1-py3-none-any.whl
Size 47.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc3c1e2398fe5902d92e40ef95356c8abf24263c7e60c7bb9a0f838f578a2d05
BLAKE2b-256 checksum
How to use checksums
380085741b941c9e3f67bc9bda0203ec5ab6947b39fabdd887c8c387d878023d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.2 Windows/10

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

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