Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.63 KB

getting_started.rst

File metadata and controls

65 lines (45 loc) · 1.63 KB

Getting Started

Installation

You can install django-phone-verify using pip. The package supports optional extras for different SMS backends:

pip install django-phone-verify          # Core install (only if you want to write your own backend)
pip install django-phone-verify[twilio]  # Twilio support
pip install django-phone-verify[nexmo]   # Nexmo (Vonage) support
pip install django-phone-verify[all]     # All supported backends

Configuration

  1. Add to ``INSTALLED_APPS``
# settings.py

INSTALLED_APPS = [
    ...
    'phone_verify',
    ...
]
  1. Configure settings
PHONE_VERIFICATION = {
    'BACKEND': 'phone_verify.backends.twilio.TwilioBackend',  # or NexmoBackend
    'OPTIONS': {
        'SID': 'fake',
        'SECRET': 'fake',
        'FROM': '+14755292729',
        'SANDBOX_TOKEN': '123456',
    },
    'TOKEN_LENGTH': 6,
    'MESSAGE': 'Welcome to {app}! Please use security code {security_code} to proceed.',
    'APP_NAME': 'Phone Verify',
    'SECURITY_CODE_EXPIRATION_TIME': 3600,
    'VERIFY_SECURITY_CODE_ONLY_ONCE': False,
}
  1. Run migrations
python manage.py migrate

This creates the SMSVerification table to store phone numbers, session tokens, and security codes.

Next Steps