Skip to main content

GraphQL integration for AllianceAuth

Reason this release was yanked:

wrong AA version

Project description

allianceauth-graphql

version GitHub issues github codecov

GraphQL integration for AllianceAuth

Free software: GNU General Public License v3

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

Compatibility

Versions >=0.16 are only compatible with AllianceAuth v3.

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',
    "graphql_jwt.refresh_token.apps.RefreshTokenConfig",
    
  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_LONG_RUNNING_REFRESH_TOKEN": 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
    from allianceauth import urls
    from django.urls import re_path
    
    urlpatterns = [
        re_path(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
    from allianceauth import urls
    from allianceauth_graphql import urls as aa_gql_urls
    from django.urls import re_path
    
    urlpatterns = [
        re_path(r'', include(urls)),
        re_path(r'graphql/', include(aa_gql_urls)),
    ]
    
    handler500 = 'allianceauth.views.Generic500Redirect'
    handler404 = 'allianceauth.views.Generic404Redirect'
    handler403 = 'allianceauth.views.Generic403Redirect'
    handler400 = 'allianceauth.views.Generic400Redirect'
    
  5. Run migrations.

  6. If you have SHOW_GRAPHIQL setting set to True (see below), run collectstatics

  7. Restart AllianceAuth.

Community Creations Integration

Currently the package supports the integration with the following community packages:

  • allianceauth-pve: v1.11.x

Be sure to check if you have the right versions of these package or the GraphQL will not have the same behaviour as the apps.

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
REDIRECT_SITE No default The URL domain for redirecting after email verification. It has to have the protocol and not the slash at the end: http(s)://<yoursite>
REDIRECT_PATH /registration/callback/ Path to append to REDIRECT_SITE for building the redirect URL

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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-1.2.0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

allianceauth_graphql-1.2.0-py2.py3-none-any.whl (75.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: allianceauth_graphql-1.2.0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for allianceauth_graphql-1.2.0.tar.gz
Algorithm Hash digest
SHA256 ada23829416b7bf54bde2bf4200c4f49cd6d76f664bad307c2e3d24f930a805a
MD5 de9c75a24db8f6c86fcf1040339a5481
BLAKE2b-256 351b19fe66a9e6cd989f08e2d8369f01d7da71e9fa75d09c630f3ba40d689456

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for allianceauth_graphql-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 551d97c6828cc7143eb6b0a6e88767a71561b791c424b01fefbb5dffd7904058
MD5 848e3522aebcd7c061b1819f949fafad
BLAKE2b-256 4c07aab05736595b09be9dbe9e7409513d67ab8f32e80a58d3019f94e7d7518d

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