在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):flavors/django-graphql-jwt开源软件地址(OpenSource Url):https://github.com/flavors/django-graphql-jwt开源编程语言(OpenSource Language):Python 99.6%开源软件介绍(OpenSource Introduction):
JSON Web Token authentication for Django GraphQL.
InstallationInstall last stable version from Pypi: pip install django-graphql-jwt Add MIDDLEWARE = [
# ...
"django.contrib.auth.middleware.AuthenticationMiddleware",
# ...
] Add GRAPHENE = {
"SCHEMA": "mysite.myschema.schema",
"MIDDLEWARE": [
"graphql_jwt.middleware.JSONWebTokenMiddleware",
],
} Add AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"django.contrib.auth.backends.ModelBackend",
] SchemaAdd 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) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论