AuthSimplified
AuthSimplified is a Django authentication package designed to give you a ready-to-use OTP-based email verification and token authentication system in minutes.
It includes user registration, login, logout, OTP verification, and OTP resend without having to write the code yourself.
Features
- User registration with OTP email verification
- Login with Django REST Framework Token authentication
- Logout with JWT refresh token blacklisting
- OTP verification with expiry checks
- Resend OTP functionality
- Customizable SMTP email sending
- Lightweight and easy to integrate into existing Django projects
Installation
Install via pip:
pip install authsimplified
Setup & Configuration
After installing, you need to integrate it into your Django project.
1. Add to Installed Apps
In your settings.py:
INSTALLED_APPS = [
...
'rest_framework',
'rest_framework.authtoken',
'authsimplified',
]
2. Configure Authentication Backends
AUTH_USER_MODEL = 'authsimplified.User'
3. Configure Django REST Framework
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.TokenAuthentication',
],
}
4. Configure SMTP for Email Sending
AuthSimplified sends OTPs via email.
You need to configure SMTP settings in your settings.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.yourmailprovider.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your_email@example.com'
EMAIL_HOST_PASSWORD = 'your_password'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
Using Gmail SMTP
If you want to use Gmail:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'yourgmail@gmail.com'
EMAIL_HOST_PASSWORD = 'your_gmail_app_password'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
Note: For Gmail, you need to create an App Password from your Google account settings.
Go to Google Account → Security → App passwords and generate one.
5. Include AuthSimplified URLs
In your project’s urls.py:
from django.urls import path, include
urlpatterns = [
...
path('auth/', include('authsimplified.urls')),
]
6. Run Migrations
python manage.py migrate
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/auth/register/ |
POST | Register a user and send OTP |
/auth/login/ |
POST | Login user with token authentication |
/auth/logout/ |
POST | Logout user and blacklist JWT token |
/auth/verify/ |
POST | Verify OTP and activate user |
/auth/resend-otp/ |
POST | Resend OTP to user’s email |
Example Usage
Register
POST /auth/register/
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123",
"first_name": "John",
"last_name": "Doe"
}
Verify OTP
POST /auth/verify/
Content-Type: application/json
{
"otp": "123456"
}
Login
POST /auth/login/
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
Metadata
Release files for authsimplified 0.1.2
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 | |
|---|---|---|---|---|
| authsimplified-0.1.2.tar.gz | 8.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| authsimplified-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / authsimplified-0.1.2.tar.gz
| Download URL | authsimplified-0.1.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcd2994fa31436883de3c25f0862513022b66a2076e0938c003d84c2eebe125a
|
|
BLAKE2b-256 checksum How to use checksums |
36076363754971128bc57e8b37591b2d553fa29786c05ac61924682cc22939f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / authsimplified-0.1.2-py3-none-any.whl
| Download URL | authsimplified-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10cb129d337592c6a2cb5256f6cab3a8aa2d5be40155df2379f0ada7f7c10963
|
|
BLAKE2b-256 checksum How to use checksums |
2b7affa45af38b984becb1205aabb16898f3a36a182111f20d1ae0e76a7eba50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for authsimplified 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.