Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

django-ai-kit-auth bundles everything authentication related and is meant to work seamlessly with the ai-kit-auth react component.

It provides routes for login, password validation, password reset, registration and account verification.

It includes a services to trigger the account validation and other functionality. It works with the standard django and with a custom user model as long as its provides an email address.

Standard Django sessions are used for authentification.

Quick Start

1.) Add ai_kit_auth to your INSTALLED_APPS like so:

INSTALLED_APPS = (
    # ...
    "rest_framework",
    # ...
    "ai_kit_auth",
    # ...
    "corsheaders",
)

rest_framework from the pip package djangorestframework and corsheaders from the pip package django-cors-headers are dependencies and must be installed.

2.) Configuration is namespaced unter AI_KIT_AUTH like so:

AI_KIT_AUTH = {
    "FRONTEND": {
        "URL": "example.com",
    },
    # ...
}

Note that FRONTEND.URL is a required configuration that does not have a default. Default configurations are:

DEFAULTS = {
    # Templates for all the email notifications to the user
    "EMAIL_TEMPLATES": {
        # is send when the user is created by registration
        "USER_CREATED": {
            "TITLE": "ai_kit_auth/user_created_title.txt",
            "BODY_PLAINTEXT": "ai_kit_auth/user_created_body.txt",
            "BODY_HTML": "ai_kit_auth/user_created_body.html",
        },
        # is send to the user after they triggered the forget password
        # feature. Contains the time limited password reset link
        "RESET_PASSWORD": {
            "TITLE": "ai_kit_auth/reset_password_title.txt",
            "BODY_PLAINTEXT": "ai_kit_auth/reset_password_body.txt",
            "BODY_HTML": "ai_kit_auth/reset_password_body.html",
        },
    },
    # If true, the user has to specify a username in addition to the
    # mail address
    "USERNAME_REQUIRED": False,
    # information about the frontend, mostly the used routes. In most cases
    # the defaults are fine, but can be changed for localisation of the
    # urls.
    # Only the actual frontend url is unset and you will get an
    # configuration error if you don't specify it.
    "FRONTEND": {
        "URL": "",
        "ACTIVATION_ROUTE": "/auth/activation/",
        "RESET_PW_ROUTE": "/auth/reset_password/",
    },
}

In addition to that some general configuration is required:

CORS_ORIGIN_WHITELIST = [
    "http://localhost:8000",
    "http://localhost:3000",
    # add other front-end backend urls
]

CORS_ALLOW_CREDENTIALS = True

CSRF_USE_SESSIONS = True

CSRF_TRUSTED_ORIGINS = [
    "http://localhost:8000",
    "http://localhost:3000",
    # add other front-end backend urls
]

The CSRF_USE_SESSIONS configuration doesn’t need to be set to enable Ai-Kit-Auth, but in prevents problems with double logins, for example if a user is logged into the Admin interface and also logged in the frontend. Django saves CSRF tokens in cookies by default.

Also see the django-cors-headers for details.

3.) Include the routes in your urls.py:

urlpatterns = [
    # ...
    re_path("^api/v1/", include("ai_kit_auth.urls"))
    # ...
]

4.) Run python manage.py migrate. Only required if you add the dependencies to your project since this package does not define models on its own.

Download files

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

Source Distribution

django-ai-kit-auth-0.2.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_ai_kit_auth-0.2.1-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file django-ai-kit-auth-0.2.1.tar.gz.

File metadata

  • Download URL: django-ai-kit-auth-0.2.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for django-ai-kit-auth-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d4ce3558451032ffe46d5938c4eee9810d8a1b098bf336b94396a1b4791a3b9c
MD5 2bfcc48b31647e350947aef6f2643d3c
BLAKE2b-256 c8f59c6123e0289d14d5e6cc98401bcb5c59824467b6952cd4fda7885875cf31

See more details on using hashes here.

File details

Details for the file django_ai_kit_auth-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: django_ai_kit_auth-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for django_ai_kit_auth-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee173f142219833a56935efd4a879b438d3b3bcc0b5120c995538fab3aaed203
MD5 c89c2e17836d8d7724ca52d9a459f85a
BLAKE2b-256 60f49958abed384ad5ab1a6d0ee7aebfbffd5dfc1e891a99decfc03a0e23fb1a

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.8.3

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page