JSON Web Token for Django REST and GraphQL.
Project description
JSON Web Token authentication for Django GraphQL.
Fantastic documentation is available at https://github.com/WeenSpace/weenspace-django-jwt.
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)
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
Built Distribution
File details
Details for the file weenspace_django_jwt-1.0.0.tar.gz
.
File metadata
- Download URL: weenspace_django_jwt-1.0.0.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cbad7cdaf07cced52bf411367299f39a124d2b615552ca961411917acf9fe8f |
|
MD5 | 38f9167d084242d79381990c376cd76d |
|
BLAKE2b-256 | 2ae14ab90aa178c5e6f33d2c38de0122642083df6bd64c0bc5f3cd29f9c65731 |
File details
Details for the file weenspace_django_jwt-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: weenspace_django_jwt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 47.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d6ad592516925214429a1e95b69baf4b6e3de4f615eec5c85e968f924917a82 |
|
MD5 | c7b8101572df7482758edaf1d5a8d63d |
|
BLAKE2b-256 | 6f3a1bbb3b1b1f1e9dbf8cd33fc6b35c04cb810385ab87923e3aba8d88a82871 |