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

This version is in alpha, please open an issue if you face any bug.

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),
        "JWT_REFRESH_EXPIRATION_DELTA": timedelta(days=7),
    }
    

    Feel free to edit the expiration limits of your tokens.

  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.2 (2022-04-05)

Implemented all the views in the authentication app:

  • Change main character
  • Add a character
  • User's groups
  • User's alts

v0.2.1 (2022-04-04)

  • Updated history and readme, no change to the code.

v0.2.0 (2022-04-04)

  • 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.3.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

allianceauth_graphql-0.3.0-py2.py3-none-any.whl (10.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: allianceauth_graphql-0.3.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for allianceauth_graphql-0.3.0.tar.gz
Algorithm Hash digest
SHA256 903a2d8ec7230fc9c6133adf2b1bd7bf445db6cdf4992cc6d5e07640ee3974a4
MD5 8dd1ec8ec6ad6b20e37192b667653b88
BLAKE2b-256 64c2ed447fe30da7ee936bbf9de81d9cfba400896f89235ed112b5cd0c94d74c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for allianceauth_graphql-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2a71541bafbd9ed50b020ae0f83addd586d83948e1751f7062acdbc287f0b092
MD5 992b42d41227bb4d14c7116fc4dc1fdf
BLAKE2b-256 a516356277ac2c0a29a7041f16f480236fb3683a6be410d3b39b04e846f7096c

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