JSON Web Token for GraphQL
Project description
JSON Web Token for GraphQL
Dependencies
Python ≥ 3.4
Django ≥ 1.11
Installation
Install last stable version from Pypi.
pip install django-graphql-jwt
Include the JWT middleware in your MIDDLEWARE settings:
MIDDLEWARE = [
...
'django.contrib.auth.middleware.AuthenticationMiddleware',
'graphql_jwt.middleware.JWTMiddleware',
...
]
Include the JWT backend in your AUTHENTICATION_BACKENDS settings:
AUTHENTICATION_BACKENDS = [
'graphql_jwt.backends.JWTBackend',
'django.contrib.auth.backends.ModelBackend'
]
Add mutations to your GraphQL schema
import graphene
import graphql_jwt
class Mutations(graphene.ObjectType):
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
schema = graphene.Schema(mutations=Mutations)
JWT by user
from graphql_jwt.utils import jwt_payload, jwt_token
payload = jwt_payload(user)
token = jwt_token(payload)
Environment variables
JWT_ALGORITHM
JWT_AUDIENCE
JWT_AUTH_HEADER_PREFIX
JWT_ISSUER
JWT_LEEWAY
JWT_SECRET_KEY
JWT_VERIFY
JWT_VERIFY_EXPIRATION
JWT_EXPIRATION_DELTA
JWT_ALLOW_REFRESH
JWT_VERIFY_REFRESH_EXPIRATION
JWT_REFRESH_EXPIRATION_DELTA
Project details
Release history Release notifications | RSS feed
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.0.2.tar.gz
(10.1 kB
view hashes)
Built Distribution
Close
Hashes for django_graphql_jwt-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d82e8ee10eabce16d71ef504f4fd2fc8b2dfab8c1a72606cc156307d36b3c967 |
|
MD5 | 030a27f7ea821d3397ab14da72c22a99 |
|
BLAKE2b-256 | 714f7087e5b53b36164febcaedd5a5a6d566b9a297e1153a8a93d1af55348a45 |