Reusable Django app for passwordless authentication via Kinde
Project description
django-kinde-auth
Reusable Django app for passwordless authentication via Kinde. Drop-in plugin for any Django project.
Install
pip install django-kinde-auth
Or with uv:
uv add django-kinde-auth
Setup
-
Add the app to
INSTALLED_APPS:INSTALLED_APPS = [ # ... "django_kinde_auth", ]
-
Configure Kinde (see Kinde configuration below).
-
Settings (in Django settings or environment):
KINDE_CLIENT_ID– from Kinde Back-end appKINDE_CLIENT_SECRET– from Kinde Back-end appKINDE_ISSUER_URL– e.g.https://<your_subdomain>.kinde.comKINDE_CALLBACK_URL– full URL of your callback (e.g.https://yourapp.com/auth/callback/)KINDE_LOGOUT_REDIRECT– (optional) URL after logout, default/KINDE_LOGIN_REDIRECT– (optional) URL after successful login, default/KINDE_REQUIRE_FOR_ADMIN– (optional) whenTrue, unauthenticated/admin/is redirected to Kinde; whenFalse, use plain Django login. DefaultFalse. Set in settings or env (KINDE_REQUIRE_FOR_ADMIN=true).
-
URLs – include the app URLs (e.g. under
/auth/):path("auth/", include("django_kinde_auth.urls", namespace="kinde_auth")),
-
Templates – add the context processor so
kinde_authenticatedandkinde_userare available globally:TEMPLATES[0]["OPTIONS"]["context_processors"].append( "django_kinde_auth.context_processors.kinde_auth" )
-
Optional: require Kinde for admin – add the middleware and set
KINDE_REQUIRE_FOR_ADMIN = True:MIDDLEWARE = [ # ... "django_kinde_auth.middleware.RequireKindeLoginForAdminMiddleware", ]
Usage in templates
{% if kinde_authenticated %}… show logged-in UI;kinde_user.full_name,kinde_user.email,kinde_user.initials, etc.- Sign in:
{% url 'kinde_auth:login' %} - Sign up:
{% url 'kinde_auth:register' %} - Sign out:
{% url 'kinde_auth:logout' %}
Usage in views
from django_kinde_auth.views import get_user_context
def my_view(request):
ctx = get_user_context(request)
if not ctx["kinde_authenticated"]:
return redirect("kinde_auth:login")
# use ctx["kinde_user"]
Kinde configuration
In the Kinde dashboard (Settings → Applications → your Back-end app):
- Callback URL – Add the exact callback URL your app uses, e.g.
http://127.0.0.1:8000/auth/callback/(local) orhttps://yourdomain.com/auth/callback/(production). - Logout redirect URL (if required) – e.g.
https://yourdomain.com/orhttp://127.0.0.1:8000/. - App keys – Copy Client ID and Client Secret into your Django settings or env.
- Issuer – Set
KINDE_ISSUER_URLtohttps://<your_subdomain>.kinde.com. - Passwordless – In Kinde, configure the connection types you want (e.g. magic link, social).
User creation and lifecycle
Kinde is the source of truth. Users are created or invited in Kinde (or self-register at /auth/register/). On first login we create the Django User automatically (username kinde_<id>, staff by default). To give admin access, set is_staff/is_superuser in Django after their first login, or set KINDE_SYNC_SUPERUSER = True in settings.
Publishing (GitHub / PyPI)
- GitHub: Push the
django-kinde-auth/directory to its own repo (or keep it in a monorepo). - PyPI: From the
django-kinde-auth/directory:pip install build twine python -m build twine upload dist/*
Or with uv:uv run buildthenuv run twine upload dist/*. Bumpversioninpyproject.tomlfor each release.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_kinde_auth-0.1.0.tar.gz.
File metadata
- Download URL: django_kinde_auth-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae86eba288dcc63ea49a136d472596b19d3e66004d1f9f7db4c738a234b80012
|
|
| MD5 |
af0ec7f08287d0339d6cc7efd79046fd
|
|
| BLAKE2b-256 |
dcea2effcac26880ff41c981670675eac89e9987819e0d8db1dffba2b26bec18
|
File details
Details for the file django_kinde_auth-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_kinde_auth-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc1bd917cc7102932bf7cc69109227f1c5c315c64671ea13c4334083ca684eda
|
|
| MD5 |
12446dd1c91555b97bb05b0db86546b1
|
|
| BLAKE2b-256 |
1120d96a2f47d8cd1752bd1b49f6489e2d3adb4bcda1121fed05e57a2efb7f46
|