Middleware in GraphQLView doesn't work in Django Ariadne Graphql

Viewed 391

i am new to ariadne, i defined my typedef and resolvers and every thing is up and runing, but i want to use django-ariadne-jwt for JWT things in my project, in django-ariadne-jwt documnets there is a line of code which doesn't work, the line is :

urlpatterns = [
  path(
      "graphql/",
      csrf_exempt(
          GraphQLView.as_view(
              schema=schema, middleware=[JSONWebTokenMiddleware()]
          )
      ),
      name="graphql"
  )
]

in GraphQLView.as_view function i pass middleware=[JSONWebTokenMiddleware()],it is necessary for authorization and token verification, but this middleware doesn't work anyway, can any one give me a solution?

django-ariadne-jwt doc: https://pypi.org/project/django-ariadne-jwt/

authentication_backends is :

AUTHENTICATION_BACKENDS = [
  "django_ariadne_jwt.backends.JSONWebTokenBackend",
  # Any other authentication backends...
  "django.contrib.auth.backends.ModelBackend",
]
0 Answers
Related