Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Django Magic Link

Opinionated Django app for managing "magic link" logins.

This app is not intended for general purpose URL tokenisation; rather it is designed to support a single use case - so-called "magic link" logins.

There are lots of alternative apps that can support this use case, including the project from which this has been extracted - django-request-tokens. The reason for yet another one is to handle the real-world challenge of URL caching / pre-fetch, where intermediaries use URLs with unintended consequences.

This packages supports a very specific model:

  1. User is sent a URL to log them in.
  2. User clicks on the link, and which does a GET request to the URL.
  3. User is presented with a confirmation page, but is not logged in.
  4. User clicks on a button and performs a POST to the same page.
  5. The POST request authenticates the user, and deactivates the token.

The advantage of this is the email clients do not support POST links, and any prefetch that attempts a POST will fail the CSRF checks.

The purpose is to ensure that someone actively, purposefully, clicked on a link to authenticate themselves. This enables instant deactivation of the token, so that it can no longer be used.

In practice, without this check, many tokenised authentication links are "used up" before the intended recipient has clicked on the link.

Download files

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

Source Distribution

django-magic-link-0.1.dev1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

django_magic_link-0.1.dev1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page