Skip to main content

A Django app to support phone number verification using OTP sent via SMS.

Project description

https://travis-ci.org/CuriousLearner/django-phone-verify.svg?branch=master

A Django app to support phone number verification using security code / One-Time-Password (OTP) sent via SMS.

Salient Features

  • Let’s you verify phone numbers via SMS.

  • Extensibility to provide different length of tokens.

  • Comes with Twilio already integrated.

  • Set expiration time on tokens.

  • Provides interface for writing custom SMS sending backend for easy extensibility.

  • Does not mess-up with existing AUTH_USER_MODEL at all.

  • Can be used for a number of potential cases, and not just auth.

  • Provides ready endpoints for sending SMS and verification (See api_endpoints.md).

Installation

pip install django-phone-verify

Usage

  • Add app to INSTALLED_APPS

# In settings.py:

# Add app to `INSTALLED_APPS`
INSTALLED_APPS = [
    ...
    'phone_verify',
]
  • Add settings for Phone Verify as you desire:

# Add settings for phone_verify to work
PHONE_VERIFICATION = {
    'BACKEND': 'phone_verify.backends.twilio.TwilioBackend',
    'TWILIO_SANDBOX_TOKEN':'123456',
    'OPTIONS': {
        'SID': 'fake',
        'SECRET': 'fake',
        'FROM': '+14755292729'
    },
    'TOKEN_LENGTH': 6,
    'MESSAGE': 'Welcome to {app}! Please use security code {otp} to proceed.',
    'APP_NAME': 'Phone Verify',
    'OTP_EXPIRATION_TIME': 3600  # In seconds only
}
  • To explore more about how to use Django Phone Verify, have a look at usage.rst

Compatibility

  • Django 2.1+

  • Django REST Framework 3.9+

Licence

GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-phone-verify-0.2.0.tar.gz (22.2 kB view details)

Uploaded Source

File details

Details for the file django-phone-verify-0.2.0.tar.gz.

File metadata

  • Download URL: django-phone-verify-0.2.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

File hashes

Hashes for django-phone-verify-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6c44ddbd39eff839be2f7b2787d77564db0ba6e839bf9d7f1759d98a43ada04e
MD5 7924c85eebd46b554b42d9b5d7e6b258
BLAKE2b-256 9edcba5b2d54eb68e753a259f33e01f72baea1b82e4bf766f9951e163388608c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page