GraphQL integration for AllianceAuth
Project description
allianceauth-graphql
GraphQL integration for AllianceAuth
Free software: GNU General Public License v3
Usage
This version is still in pre-alpha, as of v0.2.1 it only implements login.
Setup
The following is assuming you have a functioning AllianceAuth installation.
Install plugin
-
pip install allianceauth-graphql
. -
Add the following apps to the bottom of your
INSTALLED_APPS
in the local.py settings file:'allianceauth_graphql', 'graphene_django',
-
Add the following settings to your local.py file:
from datetime import timedelta # ... GRAPHENE = { 'SCHEMA': 'allianceauth_graphql.schema.schema', "MIDDLEWARE": [ "graphql_jwt.middleware.JSONWebTokenMiddleware", ], } AUTHENTICATION_BACKENDS += [ "graphql_jwt.backends.JSONWebTokenBackend", ] GRAPHQL_JWT = { "JWT_VERIFY_EXPIRATION": True, "JWT_EXPIRATION_DELTA": timedelta(days=1), }
-
Edit your projects url.py file:
It should looks something like this
from django.conf.urls import include, url from allianceauth import urls urlpatterns = [ url(r'', include(urls)), ] handler500 = 'allianceauth.views.Generic500Redirect' handler404 = 'allianceauth.views.Generic404Redirect' handler403 = 'allianceauth.views.Generic403Redirect' handler400 = 'allianceauth.views.Generic400Redirect'
After the edit:
from django.conf.urls import include, url from allianceauth import urls from allianceauth_graphql import urls as aa_gql_urls urlpatterns = [ url(r'', include(urls)), url(r'graphql/', include(aa_gql_urls)), ] handler500 = 'allianceauth.views.Generic500Redirect' handler404 = 'allianceauth.views.Generic404Redirect' handler403 = 'allianceauth.views.Generic403Redirect' handler400 = 'allianceauth.views.Generic400Redirect'
-
Restart AllianceAuth.
Settings
Setting | Default | Description |
---|---|---|
SHOW_GRAPHIQL | True |
Shows the graphiql UI in the browser |
GRAPHQL_LOGIN_SCOPES | ['publicData'] |
Tokens needed. Unlike AllianceAuth pages, you need to login with the scopes you'll use, otherwise you won't be able to perform some queries |
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
v0.2.1
- Updated history and readme, no change to the code
v0.2.0
- Working login with django-graphql-jwt
v0.1.1 (2022-04-02)
- Working /graphql/ endpoint and updated requirements.
v0.1.0 (2022-03-18)
- First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for allianceauth_graphql-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d34f4402ec269ba416e46b9bb0d2ac840c7667011721ec0beec8ebc22cce747e |
|
MD5 | 51eab1d44b91f8b53d720d77edf79bb4 |
|
BLAKE2b-256 | 19bda115f7f09066f8ca44053cfda9341ceca5191582c0e82b9cda3ccc752ac6 |
Hashes for allianceauth_graphql-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22c40db5717cd0fdd5e798eb44f0c71ff4c7584e525dfc01b42739fbeb84d6c9 |
|
MD5 | 56dd242603ad806b300e3abb0b8fa8a6 |
|
BLAKE2b-256 | 566e0c57a8c34b296d2da4a7d05e4515ff7b6dc44a52ab0d70532c2ecad00f41 |