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("JB_DRF_AUTH_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
),
"MOBILE_NOTIFICATION_TOKEN_REQUIRED": env.bool(
"MOBILE_NOTIFICATION_TOKEN_REQUIRED", default=False
),
"ADMIN_BOOTSTRAP_TOKEN": env("JB_DRF_AUTH_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.
Recommended convention: use JB_DRF_AUTH_ prefix for library-related env vars.
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.
Metadata
Release files for jb-drf-auth 0.1.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jb_drf_auth-0.1.21.tar.gz | 79.2 kB | With provenance | Details for jb_drf_auth-0.1.21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jb_drf_auth-0.1.21-py3-none-any.whl | Python 3 | none | any | Details for jb_drf_auth-0.1.21-py3-none-any.whl |
Total release size: 199.2 kB
Release files / jb_drf_auth-0.1.21.tar.gz
| Download URL | jb_drf_auth-0.1.21.tar.gz |
|---|---|
| Size | 79.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d3df4b61c70a5166d3ccc1c5a70161db34f21e6ff67c1200ebbf508df19623c
|
|
BLAKE2b-256 checksum How to use checksums |
bf36a05b4ebbe7f6b51966769f07d3d20539148f3e7d8bdbb3ce904dd1b3a02a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logRelease files / jb_drf_auth-0.1.21-py3-none-any.whl
| Download URL | jb_drf_auth-0.1.21-py3-none-any.whl |
|---|---|
| Size | 120.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e12435483186b3d7008eb3252e4aa319d67433eb98d327323f538a4244f1984
|
|
BLAKE2b-256 checksum How to use checksums |
a8cb12977b16da664723c91afd2e29135ffc20cdc5a1517301ab1ebc8f3419a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logSecurity for jb-drf-auth 0.1.21
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for jb_drf_auth-0.1.21.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.