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.3.tar.gz (24.3 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.3-py2.py3-none-any.whl (45.1 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: django-graphql-jwt-0.3.3.tar.gz
  • Upload date:
  • Size: 24.3 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.3.tar.gz
Algorithm Hash digest
SHA256 a8e7d8a9d4a4ddc87d65d99a5e62b696d18209370c3ce6917b33fb23c98555af
MD5 76ce4933897f440669b25cded289ee6c
BLAKE2b-256 2286ab5aa745a41affb43ba1667adf9292f543a68d095d173aaedf7e926590e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_graphql_jwt-0.3.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 45.1 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.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d784b5daf5e40b22c15c3b00988919daea08f3ed5aea47426da1167fc46d7dc1
MD5 eaeb78b3cf2e721d361c41d9ecae41ba
BLAKE2b-256 74ec95a2db05a7d6be13d8d8bb525bd0c9dc87f5c6baa6ed5acad1fa8c2230ee

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