Skip to main content

GraphQL integration for AllianceAuth

Project description

allianceauth-graphql

version GitHub issues github

GraphQL integration for AllianceAuth

Free software: GNU General Public License v3

Usage

This version is still in pre-alpha, as of v0.1.1 it does nothing.

Setup

The following is assuming you have a functioning AllianceAuth installation.

Install plugin

  1. pip install allianceauth-graphql.

  2. Add the following apps to the bottom of your INSTALLED_APPS in the local.py settings file:

    'allianceauth_graphql',
    'graphene_django',
    
  3. 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),
    }
    
  4. 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'
    
  5. 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.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

allianceauth_graphql-0.2.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

allianceauth_graphql-0.2.0-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file allianceauth_graphql-0.2.0.tar.gz.

File metadata

  • Download URL: allianceauth_graphql-0.2.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for allianceauth_graphql-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f1fdb43ba93aa85dab235ff564eeffe19b6153392d98af876282e46ba3526c1
MD5 5ea17475fcf66109387636e76f5e41f0
BLAKE2b-256 43ca453b9302d9cf5ee50ce2c4ba3098393cd4fa3e0d074b1c64993633168b9e

See more details on using hashes here.

File details

Details for the file allianceauth_graphql-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: allianceauth_graphql-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for allianceauth_graphql-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2ddf4b9b55ce6fb3309867c03ec42e0420e2ca3897fc8855e238b3a4e08d177b
MD5 68ab5eafb17d904d87ab7115dd2ee596
BLAKE2b-256 dee1622f960122722231801f0ae93fbbd2584356453cffb62eaf5743e4834c52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page