Browse Apps

AllianceAuth GraphQL

GraphQL integration for AllianceAuth


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

```python
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:

```python
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'
```
  1. Run migrations.
  2. If you have SHOW_GRAPHIQL setting set to True (see below), run collectstatics
  3. 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.

No reviews yet...

Python Requirements

Required Python packages to be installed and other Python requirement.

App Dependencies


Required apps:

Used by apps:

    -

Dependencies to other apps registered in this app directory.

Classifiers

  • Development Status :: 4 - Beta
  • Environment :: Web Environment
  • Framework :: Django
  • Framework :: Django :: 4
  • Framework :: Django :: 4.2
  • Intended Audience :: Developers
  • License :: OSI Approved :: GNU General Public License v3 (GPLv3)
  • Natural Language :: English
  • Operating System :: POSIX :: Linux
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: 3.12
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Topic :: Internet :: WWW/HTTP
  • Topic :: Internet :: WWW/HTTP :: Dynamic Content

Version

1.3.0

License

GPLv3

Homepage

  https://github.com/Maestro-Zacht/allianceauth-graphql

PyPI

  https://pypi.org/project/allianceauth-graphql/

Last updated

8 months, 1 week ago

First published

2 years, 7 months ago

Category

Infrastructure

Rating

-

Authors

Matteo Ghia

Maintainers

Maestro Zacht Maestro Zacht

Please login to see more options.