A Django app to support phone number verification using security code sent via SMS.
Project description
A Django app to support phone number verification using the security code sent via SMS.
Salient Features
Let’s devs verify phone numbers via SMS.
Extensibility to provide tokens with varying lengths.
Comes with Twilio and Nexmo already integrated.
Set expiration time on tokens.
Provides an 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 several potential use-cases, and not just auth.
Provides ready endpoints for sending SMS and verification (See api_endpoints.rst).
Installation
pip install django-phone-verify[all]
You also have option to install only the required dependencies for Twilio or Nexmo:
pip install django-phone-verify[twilio]
pip install django-phone-verify[nexmo]
Configuration
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:
# In settings.py
# Add settings for phone_verify to work
PHONE_VERIFICATION = {
"BACKEND": "phone_verify.backends.twilio.TwilioBackend",
"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, # In seconds only
"VERIFY_SECURITY_CODE_ONLY_ONCE": False, # If False, then a security code can be used multiple times for verification
}
Usage
To explore more about how to use, integrate and leverage the existing functionality of Django Phone Verify, have a look at getting_started.rst
Note: Django Phone Verify also provides Nexmo as a backend service other than Twilio. To switch to Nexmo, replace BACKEND within your PHONE_VERIFICATION setting with phone_verify.backends.nexmo.NexmoBackend and define KEY within OPTIONS of PHONE_VERIFICATION setting, with your Nexmo API key, in place of already available SID.
Compatibility
Python 3.6+
Django 2.1+
Django REST Framework 3.9+
Contributing
No code is bug-free and I’m sure this app will have bugs. If you find any bugs, please create an issue on GitHub.
Licence
GPLv3
Changelog
See changelog.rst
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_phone_verify-3.0.1.tar.gz.
File metadata
- Download URL: django_phone_verify-3.0.1.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb4f1429eaed67b60e0757740a15ea3d78278512148f7cca5675c2fbca9c9f53
|
|
| MD5 |
bedc67faafb04181a0aeea3005cf41d6
|
|
| BLAKE2b-256 |
ce9b6aea2f0a5690772bf823b99d0cba54a94a6fe1daf5f638d1cd1a408ae95b
|
File details
Details for the file django_phone_verify-3.0.1-py3-none-any.whl.
File metadata
- Download URL: django_phone_verify-3.0.1-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45807c969aa95133be6cb1d58f352f5faf989f6a1e6fa3471844b0bef011de63
|
|
| MD5 |
10f3223cfa16b82f40f78436dc8b16ec
|
|
| BLAKE2b-256 |
0c4dbf6ac29f6efa256685c0ac7a0928c8368d98414d444aa32c8622b27248cc
|