https://github.com/obaraelijah/django-otp
Django (DRF) OTP Authentication and Verification
https://github.com/obaraelijah/django-otp
authentication-backend authorization django django-rest-framework docker otp otp-verification twillio-api
Last synced: 8 months ago
JSON representation
Django (DRF) OTP Authentication and Verification
- Host: GitHub
- URL: https://github.com/obaraelijah/django-otp
- Owner: obaraelijah
- Created: 2023-08-20T09:32:23.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-23T16:56:03.000Z (almost 3 years ago)
- Last Synced: 2025-04-06T10:36:52.720Z (about 1 year ago)
- Topics: authentication-backend, authorization, django, django-rest-framework, docker, otp, otp-verification, twillio-api
- Language: Python
- Homepage:
- Size: 245 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Django - DRF & OTP verification
👋This app shows how to handle mobile phone authentication and verification for a user management solution.
Complete guide: [Click here](https://medium.com/aws-tip/implementing-mobile-number-verification-and-otp-based-authentication-in-django-django-rest-48c54382e989)
## Tools & Services:
- Django & DRF : for building the APIs
- Docker & Docker compose: Containerization
- Celery: For running background task
- Rabbit MQ: A message broker for celery
- Flower dashboard: For monitoring celery background tasks
- PostgreSQL: Relational DB
- Twilio: SMS notifications
## By the end of this tutorial
- Onboard a user on the system via phone number verification
- Reset user password via OTP sent to user.
- Authenticate a user using phone number and password
## Running locally
Create a .env file by copying the .env.sample provided and run:
```
docker compose build && docker compose up
```
to start the container. As an alternative, run:
```
docker-compose -f docker-compose.dev.yml up --build
```
to build and run the container using the dev yaml file.
Make sure to externalize the db instance to be used. It can be in another container.
## Run tests
Run descriptive tests in the container using:
```
docker compose exec pytest -rP -vv
```
Access the docs on:
```
http://localhost:8000/api/v1/doc
```
## Running In a Virtual Env
Create a virtual environment using:
```
mkvirtualenv
```
Ensure you have installed `virtualenv` on your system and install dev dependencies using
```
pip install -r app/requirements/dev.txt
```
Navigate to app directory and run migrations using:
```
python manage.py makemigrations
python manage.py migrate
```
Run the server using:
```
python manage.py runserver
```
Access docs:
```sh
http://localhost:8000/api/v1/doc
```

