Skip to content

Instantly share code, notes, and snippets.

@joaquinacuna
Last active July 16, 2021 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaquinacuna/b2ec5e6d173fd3bba3363705e5a6bba7 to your computer and use it in GitHub Desktop.
Save joaquinacuna/b2ec5e6d173fd3bba3363705e5a6bba7 to your computer and use it in GitHub Desktop.
# auth.settings.py
INSTALLED_APPS = [
# ...
'django.contrib.staticfiles', # Required for GraphiQL
'graphene_django',
# refresh tokens are optional
'graphql_jwt.refresh_token.apps.RefreshTokenConfig',
]
MIDDLEWARE = [
# ...
'django.contrib.auth.middleware.AuthenticationMiddleware',
# ...
]
GRAPHENE = {
'SCHEMA': 'auth.schema.schema', # this file doesn't exist yet
'MIDDLEWARE': [
'graphql_jwt.middleware.JSONWebTokenMiddleware',
],
}
AUTHENTICATION_BACKENDS = [
'graphql_jwt.backends.JSONWebTokenBackend',
'django.contrib.auth.backends.ModelBackend',
]
GRAPHQL_JWT = {
"JWT_VERIFY_EXPIRATION": True,
# optional
"JWT_LONG_RUNNING_REFRESH_TOKEN": True,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment