django-sesame
Frictionless authentication with "Magic Links" for your Django project.
What it is and what it does
django-sesame is a Django authentication backend that replaces password-based login with token-based "Magic Links." When you generate a link containing a token and send it to a user (typically via email), clicking that link authenticates them without requiring a password. The package handles token generation, validation, and user authentication through a pluggable Django backend.
It's designed for scenarios where password entry is inconvenient or unnecessary: mobile login flows, time-limited authenticated links for reports or shared content, WebSocket authentication, and private sites where users don't manage personal accounts. The documentation explicitly warns that whoever obtains a token can authenticate, so tokens should be short-lived or single-use depending on your threat model. The package uses modern cryptography for token security and provides configuration options for token invalidation.
Use it for:
- Send login links via email for mobile-friendly passwordless login, similar to Slack's approach.
- Generate time-limited authenticated links to reports or documents that work even if the user isn't logged in.
- Create shareable links for guests to access specific content without logging them into a full account.
- Authenticate WebSocket connections by passing a token from the Django server to a WebSocket client.
- Simplify access to private community or family sites where users bookmark personalized authenticated URLs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
django-sesame provides token-based authentication for Django projects using "Magic Links"—URLs containing authentication tokens that log users in without passwords.
Yes, if you need passwordless authentication for Django and accept the security tradeoff that tokens in URLs are inherently exposed to logs, emails, and browser history. The package is stable (Production/Stable status), well-maintained despite aging release cadence, has no known vulnerabilities, and integrates cleanly with Django's auth system. Review the (in)security section of the documentation before deploying to understand token lifetime and invalidation strategy for your use case.
Install
django-sesame on PyPI
pip
pip install django-sesameuv
uv add django-sesamepoetry
poetry add django-sesameInstalling django-sesame
Before you install
Low install friction with a single runtime dependency on django. Maintenance status is aging—last release was 469 days ago, though the repository remains active with a recent commit on 2026-01-05 and 1034 stars.
License in practice
BSD-3-Clause is a permissive license; you can use, modify, and distribute django-sesame with minimal restrictions, provided you include the license notice.
Quickstart
pip install django-sesame
# In Django settings.py:
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
"sesame.backends.ModelBackend",
]
# Generate a login URL:
from sesame.utils import get_query_string
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.first()
login_url = "https://example.com/sesame/login/" + get_query_string(user)
Requires django.contrib.auth to be enabled in your Django project; Python ≥ 3.9 and Django 4.2, 5.0, 5.1, or 5.2.
Verify before relying
- Whether token expiration (SESAME_MAX_AGE) defaults are suitable for your use case without explicit configuration.
- Performance impact of token validation on high-traffic sites.
- Compatibility with custom user models beyond the default Django User model.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — django |
| Maintenance | aging — 469 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 258,503/month — #8,429 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_sesame-3.2.3-py3-none-any.whl
Keywords: authentication, token-based-authentication
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-magiclinkAdds passwordless email-based authentication to…
permissive · top 15,000 on PyPI
django-authlibProvides passwordless authentication for Django…
permissive · top 15,000 on PyPI
djangorestframework-simplejwtProvides JSON Web Token (JWT) authentication…
permissive · top 5,000 on PyPI
drf-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
django-rest-knoxProvides token-based authentication for Django…
permissive · top 5,000 on PyPI
django-auth-ldapProvides a Django authentication backend that…
permissive · top 15,000 on PyPI
dj-rest-authProvides drop-in REST API endpoints for user…
permissive · top 5,000 on PyPI
django-rest-passwordresetProvides REST API endpoints for Django…
permissive · top 15,000 on PyPI
django-auth-adfsIntegrates Django applications with Microsoft…
permissive · top 15,000 on PyPI
quart-authQuart-Auth provides session-based…
permissive · top 15,000 on PyPI