Skip to main content

OBytes django application for managing OTP (OneTruePairing) for authentication, registration and changing phone number.

Project description

OBytes Django OTP App

Build & Test pypi license downloads python docs health-check

OTP is a Django app to conduct Web-based one true pairing, for authentication, registration and changing phone number.

Quick start

  1. Install ob_dj_otp latest version pip install ob_dj_otp

  2. Add "ob_dj_otp" to your INSTALLED_APPS setting like this:

   # settings.py
   INSTALLED_APPS = [
        ...
        "ob_dj_otp.core.otp",
   ]
   # Setting Twilio as SMS Provider
   OTP_PROVIDER = os.environ.get("OTP_PROVIDER", "twilio")
   # Passing Twilio Verify Service-ID
   OTP_TWILIO_SERVICE = os.environ.get("OTP_PROVIDER")
  1. Include the OTP URLs in your project urls.py like this::
    # urls.py
    path("otp/", include("ob_dj_otp.apis.otp.urls")),
  1. Run python manage.py migrate to create the otp models.

Extending API Serializers

OTP Verification serializer can be extended as following:

# utils.py
from ob_dj_otp.apis.otp.serializers import OTPVerifyCodeSerializer
from rest_framework import serializers

class NewOTPVerifyCodeSerializer(OTPVerifyCodeSerializer):
    # write_only is required to prevent errors when reading from OTP Object for the attr
    email = serializers.CharField(max_length=100, required=True, write_only=True)

    class Meta:
        fields = OTPVerifyCodeSerializer.Meta.fields + ("email",)
        model = OTPVerifyCodeSerializer.Meta.model

# add path to Serializer to django settings
OTP_VERIFICATION_SERIALIZER = "full.path.NewOTPVerifyCodeSerializer"

Developer Guide

  1. Clone github repo git clone [url]

  2. pipenv install --dev

  3. pre-commit install

  4. Run unit tests pytest

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

ob-dj-otp-0.0.14.tar.gz (58.4 kB view hashes)

Uploaded Source

Built Distribution

ob_dj_otp-0.0.14-py3-none-any.whl (16.6 kB view hashes)

Uploaded Python 3

Supported by

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