graphql-python authentication issue
Author: sthristovCreated Apr 29, 2019Updated Jun 15, 2026
Hello,
I was going through the graphql-python Authentication part and I got an error when I reached the "Configuring django-graphql-jwt" part.
Internal Server Error: /graphql/
Traceback (most recent call last):
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 62, in view
self = cls(**initkwargs)
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/graphene_django/views.py", line 88, in __init__
self.middleware = list(instantiate_middleware(middleware))
File "/Users/***/django-gql/venv/lib/python3.7/site-packages/graphene_django/views.py", line 48, in instantiate_middleware
yield middleware()
TypeError: __init__() missing 1 required positional argument: 'get_response'The way I was able to get the demo working was to change "MIDDLEWARE" to "MIDDLEWARES" in file "hackernews/hackernews/settings.py":
GRAPHENE = {
'SCHEMA': 'hackernews.schema.schema',
'MIDDLEWARES': [
'graphql_jwt.middleware.JSONWebTokenMiddleware',
],
}Let me know if you want me to make a PR.
Cheers, Stan
Source: howtographql/howtographql