2

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",
]
Ahmad Mansoori
  • 177
  • 1
  • 11
  • 1
    "It doesn't work" is not enough information to go on. What specifically is not working? Have you configured `AUTHENTICATION_BACKENDS` correctly? – Iain Shelvington Jun 22 '20 at 19:10
  • @IainShelvington hi,thank you, yes i set AUTHENTICATION_BACKENDS in settings file, i added the in question,what i mean by "it does not work" is simply the resolve function in JSONWebTokenMiddleware is not working and my user attribute in info.context in my resolver function in Anonynous. – Ahmad Mansoori Jun 26 '20 at 16:43

0 Answers0