Skip to main content

JSON Web Token for Django GraphQL

Project description

Pypi Build Status Codecov Codacy

JSON Web Token authentication for Django GraphQL

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)

Documentation

Fantastic documentation is available at https://django-graphql-jwt.domake.io.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-graphql-jwt-0.3.1.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_graphql_jwt-0.3.1-py2.py3-none-any.whl (42.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-graphql-jwt-0.3.1.tar.gz.

File metadata

  • Download URL: django-graphql-jwt-0.3.1.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0

File hashes

Hashes for django-graphql-jwt-0.3.1.tar.gz
Algorithm Hash digest
SHA256 468e09b8ce67324fcba21dc33b7c1ea9d234bfc10df7cbfe9c5477be0302f933
MD5 d89d31f209b3688e659c44c0f0634840
BLAKE2b-256 586f453b5c9b9f07088540d5a2ec32f86d6b007894ca2827fd58ad028091f64c

See more details on using hashes here.

File details

Details for the file django_graphql_jwt-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_graphql_jwt-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 42.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0

File hashes

Hashes for django_graphql_jwt-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2189f6d1a13b827d486780fa74a631a15e4f7f0235a3a87a487736b5b0dc4690
MD5 bb4fdd0d4b09c96cd0a6c15c0d572d72
BLAKE2b-256 1defbe98e50960ed57e79bdac24d3a26072690179332d63e90294337d6e2ee16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page