Reusable auth + profiles foundations for Django/DRF projects
Project description
jb-drf-auth
Reusable authentication module for Django + Django REST Framework.
PyPI: https://pypi.org/project/jb-drf-auth/
TestPyPI: https://test.pypi.org/project/jb-drf-auth/
jb-drf-auth is a reusable foundation for authentication flows across projects, including:
- User/profile base models (extensible)
- OTP flows (email/SMS)
- Login, registration, password reset, email confirmation
- Multi-profile support
- Provider-based SMS/email architecture
- Configurable behavior via Django settings
Installation
pip install jb-drf-auth
Add jb_drf_auth and rest_framework to INSTALLED_APPS.
Documentation
- Main docs index:
docs/README.md - Getting started and configuration:
docs/getting-started.md - API contract (endpoint by endpoint):
docs/API_CONTRACT.md - Social authentication guide:
docs/social-auth.md - Migration guide:
docs/migration.md - i18n integration guide:
docs/i18n.md - Release guide:
docs/release.md - Roadmap:
roadmap.md
Quick Start
- Configure concrete models in your project (
User,Profile,Device,OtpCode, logs). - Configure
JB_DRF_AUTHsettings (minimal real-world example):
JB_DRF_AUTH = {
"PROFILE_MODEL": "authentication.Profile",
"DEVICE_MODEL": "authentication.Device",
"OTP_MODEL": "authentication.OtpCode",
"SMS_LOG_MODEL": "authentication.SmsLog",
"EMAIL_LOG_MODEL": "authentication.EmailLog",
"FRONTEND_URL": env("FRONTEND_URL", default="http://localhost:3000"),
"DEFAULT_FROM_EMAIL": "no-reply@your-domain.com",
"AUTHENTICATION_TYPE": "both", # "email", "username", "both"
"AUTH_SINGLE_SESSION_ON_MOBILE": env.bool(
"AUTH_SINGLE_SESSION_ON_MOBILE", default=False
),
"ADMIN_BOOTSTRAP_TOKEN": env("ADMIN_BOOTSTRAP_TOKEN", default="super-secret-token"),
"PROFILE_PICTURE_UPLOAD_TO": "uploads/users/profile-pictures",
"PERSON_ID_DOCUMENTS_UPLOAD_TO": "uploads/people/id-documents",
"PROFILE_ROLE_CHOICES": (
("PATIENT", "Patient"),
("DOCTOR", "Doctor"),
("ADMIN", "Admin"),
),
"DEFAULT_PROFILE_ROLE": "PATIENT",
"SMS_SENDER_ID": "YourBrand",
"SMS_OTP_MESSAGE": "Tu codigo para acceder a Mentalysis es {code}. Expira en {minutes} minutos.",
}
If you use env(...)/env.bool(...), ensure environ.Env() is configured in your settings module.
3. Mount URLs:
from django.urls import include, path
urlpatterns = [
path("auth/", include("jb_drf_auth.urls")),
]
- Run migrations in the integrator project.
For complete setup examples (including full JB_DRF_AUTH dict), see docs/getting-started.md.
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 jb_drf_auth-0.1.8.tar.gz.
File metadata
- Download URL: jb_drf_auth-0.1.8.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7b33584a18636536913182b0633a3cff5f6b50b400b6e1fcaae3ad581763e1b
|
|
| MD5 |
fecda9a16f2f0208e9d331c3279d9077
|
|
| BLAKE2b-256 |
b0668001bf4eedcef0c764d1cd78d355bab4b89fc47197156119e8492e6d1e21
|
Provenance
The following attestation bundles were made for jb_drf_auth-0.1.8.tar.gz:
Publisher:
pypi-publish.yml on joelbarron/jb-drf-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jb_drf_auth-0.1.8.tar.gz -
Subject digest:
b7b33584a18636536913182b0633a3cff5f6b50b400b6e1fcaae3ad581763e1b - Sigstore transparency entry: 951782258
- Sigstore integration time:
-
Permalink:
joelbarron/jb-drf-auth@1bcc85da9e7a91ffec72d05a4f6554d47b4f3b8d -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/joelbarron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1bcc85da9e7a91ffec72d05a4f6554d47b4f3b8d -
Trigger Event:
release
-
Statement type:
File details
Details for the file jb_drf_auth-0.1.8-py3-none-any.whl.
File metadata
- Download URL: jb_drf_auth-0.1.8-py3-none-any.whl
- Upload date:
- Size: 70.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
400fa3652408ca40321bd372a8dad4cb263514af182dac92f65748f8d159d3ce
|
|
| MD5 |
3c7550f2ba8bffd92e1a86cc53d629e0
|
|
| BLAKE2b-256 |
fcce4de1b05065153063b677734baff13e0823ba1a1f9ef5344aa6e1e950eff9
|
Provenance
The following attestation bundles were made for jb_drf_auth-0.1.8-py3-none-any.whl:
Publisher:
pypi-publish.yml on joelbarron/jb-drf-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jb_drf_auth-0.1.8-py3-none-any.whl -
Subject digest:
400fa3652408ca40321bd372a8dad4cb263514af182dac92f65748f8d159d3ce - Sigstore transparency entry: 951782328
- Sigstore integration time:
-
Permalink:
joelbarron/jb-drf-auth@1bcc85da9e7a91ffec72d05a4f6554d47b4f3b8d -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/joelbarron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@1bcc85da9e7a91ffec72d05a4f6554d47b4f3b8d -
Trigger Event:
release
-
Statement type: