Short Description:
A secure OTP (One-Time Password) verification system built with Flask, Twilio, and OpenSearch. It allows sending OTPs to users’ phone numbers, verifying them, and logging all events to OpenSearch for analytics and monitoring.
- Send OTPs to phone numbers using Twilio API.
- Verify OTPs with session-based authentication.
- Log all OTP events (sent, verified, failed) in OpenSearch.
- Flask web interface for requesting and verifying OTPs.
- Dockerized setup for easy deployment with OpenSearch and OpenSearch Dashboards.
- Backend: Python, Flask, Flask-Session
- Messaging: Twilio API
- Database & Search: OpenSearch
- Containerization: Docker, Docker Compose
- Frontend: HTML/CSS (Jinja2 templates)
-
Clone the repository
git clone <your-repo-url> cd "OTP Verification with OpenSearch Logging"
-
Create a
.envfile in the root directory:TWILIO_ACCOUNT_SID=YOUR_TWILIO_ACCOUNT_SID TWILIO_AUTH_TOKEN=YOUR_TWILIO_AUTH_TOKEN TWILIO_PHONE_NUMBER=YOUR_TWILIO_PHONE_NUMBER
-
Run with Docker Compose
starting
docker-compose pull docker-compose up -d
stopping
docker-compose down
-
Access the App
- Flask App:
http://localhost:5000 - OpenSearch Dashboard:
http://localhost:5601
- Flask App:
- Enter your phone number in the form.
- Receive the OTP on your phone via Twilio.
- Enter the OTP to verify.
- All events are logged in OpenSearch (
otp_logsindex).
OTP Verification with OpenSearch Logging/
├── app.py # Flask application
├── templates/ # HTML templates
│ └── index.html
├── static/ # Static files (CSS, JS, images)
│ └── style.css
├── Dockerfile # Dockerfile for Flask app
├── docker-compose.yml # Docker Compose setup
├── .env # Environment variables (Twilio credentials)
├── README.md # Project documentation
└── requirements.txt # Python dependencies
- Fork the repository.
- Create a new branch:
git checkout -b feature-name - Make your changes and commit:
git commit -m "Description" - Push to your branch:
git push origin feature-name - Open a Pull Request.
This project is licensed under the MIT License.