Skip to main content

Django GraphQL JWT

JSON Web Token authentication for Django GraphQL.
Fantastic documentation is available at https://django-graphql-jwt.domake.io.

Test Coverage Codacy Package version

Installation

Install last stable version from Pypi:

pip install django-graphql-jwt

Add AuthenticationMiddleware middleware to your MIDDLEWARE settings:

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

Add JSONWebTokenMiddleware middleware to your GRAPHENE settings:

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

Add JSONWebTokenBackend backend to your AUTHENTICATION_BACKENDS:

AUTHENTICATION_BACKENDS = [
    "graphql_jwt.backends.JSONWebTokenBackend",
    "django.contrib.auth.backends.ModelBackend",
]

Schema

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

import graphene
import graphql_jwt


class Mutation(graphene.ObjectType):
    token_auth = graphql_jwt.ObtainJSONWebToken.Field()
    verify_token = graphql_jwt.Verify.Field()
    refresh_token = graphql_jwt.Refresh.Field()


schema = graphene.Schema(mutation=Mutation)

Release files for django-graphql-jwt 0.4.0

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

Source distribution (sdist)

Source distribution for django-graphql-jwt 0.4.0
File Size Uploaded
django_graphql_jwt-0.4.0.tar.gz 20.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-graphql-jwt 0.4.0
File Interpreter ABI Platform
django_graphql_jwt-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.7 kB

Release files / django_graphql_jwt-0.4.0.tar.gz

Download URL django_graphql_jwt-0.4.0.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
537972519f0deeec7a0e4a306ddfed1fe385266ef61c9f78c54cd04ac01a171e
BLAKE2b-256 checksum
How to use checksums
a8446781e0ef4438f9f8b8b0fc39d4e874659b555bc57159243faee99c66483e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / django_graphql_jwt-0.4.0-py3-none-any.whl

Download URL django_graphql_jwt-0.4.0-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5823aa8ac9bf0b7a6e3b2febd029598b332c41fe9043d89900c116fcecd23f5e
BLAKE2b-256 checksum
How to use checksums
96829b6e9425515ccec08894f3dbdd2b439244859c5516777a576b929eb6f854
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

1 release file

0.2.0

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

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