Welcome to Django Phone Verify!#
Secure phone number verification for Django applications
django-phone-verify is a production-ready Django library that provides phone number verification via SMS.
Whether youβre building user registration, two-factor authentication, account recovery, or any feature requiring
phone verification, this library handles the complexity so you can focus on your application.
Why Django Phone Verify?#
β Production-Ready - Used in production by companies worldwide, battle-tested and secure
β Easy Integration - Works with Django REST Framework or standard Django views
β Flexible - Supports Twilio, Nexmo/Vonage, or write your own backend for any SMS provider
β Secure by Design - JWT session tokens, configurable expiration, one-time codes, rate limiting support
β Well Documented - Comprehensive documentation with real-world examples
Quick Example#
from phone_verify.services import send_security_code_and_generate_session_token
from phone_verify.services import verify_security_code
# Send verification code via SMS
session_token = send_security_code_and_generate_session_token("+1234567890")
# User receives SMS: "Your verification code is 847291"
# Verify the code
verify_security_code("+1234567890", "847291", session_token)
# Returns: SECURITY_CODE_VALID
Thatβs it! Phone verification in 3 lines of code.
Installation#
# For Twilio users
pip install django-phone-verify[twilio]
# For Nexmo/Vonage users
pip install django-phone-verify[nexmo]
# Install all backends
pip install django-phone-verify[all]
See Getting Started for complete installation and configuration instructions.
π Documentation Sections#
New to django-phone-verify? Start here!#
Essential Guides#
Advanced Usage#
Reference & Help#
Common Use Cases#
Choose your use case to see a complete implementation:
- π± User Registration - Verify phone numbers during signup
See the integration examples in Integration Guide
- π Two-Factor Authentication (2FA) - Add SMS-based 2FA to login
Complete example in Advanced Examples
- π Password Reset - Allow users to reset passwords via SMS
Step-by-step guide in Advanced Examples
- π§ Marketing Opt-In - Verify phone numbers for SMS marketing
Implementation in Advanced Examples
- π Phone Number Updates - Securely update user phone numbers
Secure flow in Advanced Examples
Features at a Glance#
Security
JWT-based session tokens prevent tampering
Configurable code expiration (recommended: 5-10 minutes)
One-time code usage option
Rate limiting support to prevent abuse
GDPR/CCPA compliance guidance
Integration
Works with Django REST Framework (pre-built viewsets)
Works with standard Django views and forms
Compatible with any
AUTH_USER_MODELNo changes required to your user model
SMS Providers
Twilio - Built-in support via
TwilioBackendNexmo/Vonage - Built-in support via
NexmoBackendCustom - Write backends for AWS SNS, MessageBird, Plivo, etc.
Sandbox mode - Test without sending real SMS
Customization
Custom message templates with dynamic content
Configurable security code length
Custom validation logic
Async/Celery support for better performance
Multi-backend support (fallback providers)
Requirements#
Python 3.8+
Django 2.1+
Django REST Framework 3.9+ (optional, for API endpoints)
Twilio or Nexmo account (for production SMS)
Getting Help#
If youβre stuck or have questions:
Check the FAQ - Frequently Asked Questions (FAQ) answers common questions
Read Troubleshooting - Troubleshooting covers common issues
Review Examples - Advanced Examples has real-world implementations
Check API Docs - API Reference for detailed API information
Open an Issue - GitHub Issues
Security Issues - See our Security Policy
Contributing#
We welcome contributions! Whether itβs bug reports, feature requests, documentation improvements, or code:
π Report bugs
π‘ Suggest features or improvements
π Improve documentation
π§ Submit pull requests
See Contributing for guidelines.
License#
django-phone-verify is licensed under the GNU General Public License v3 (GPLv3).
See the LICENSE file for details.