Skip to content

One Time Password/Token Generation and Validation #22

Open
@selwin

Description

@selwin

Code of Conduct

  • I agree to follow Django's Code of Conduct

Feature Description

A built in way for Django to generate and validate one time tokens.

Problem

Many web apps use single-use codes for:

  • Passwordless login
  • Email/phone verification
  • 2FA

Despite being a common requirement, Django currently lacks a built-in, standardized mechanism for generating and validating one-time passwords (OTPs).

Request or proposal

proposal

Additional Details

No response

Implementation Suggestions

Proposed APIs (obviously I'm still open to suggestions):

from django.auth import otp

token = otp.create(key, ttl, length, allowed_chars)

# Passing in `delete=True` would  invalidate the token after successful validation
otp.authenticate(key, token, invalidate=False)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Idea

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions