OTP Authentication with Twilio and FastAPI
A simple and scalable OTP (One-Time Password) authentication system for logging into web or mobile apps using FastAPI and Twilio.
π§ Features
- β
Send OTP via SMS using Twilio
- β
Verify OTP for secure login
- β
FastAPI-based backend
- β
Interactive API docs with Swagger and ReDoc
π Getting Started
1. Clone the Repository
git clone https://github.com/yourusername/otpauthentication.git
cd otpauthentication
2. Create & Activate Virtual Environment
On Windows
python -m venv venv
venv\Scripts\activate
On macOS/Linux
python3 -m venv venv
source venv/bin/activate
3. Install Dependencies
pip install -r requirements.txt
To save updated packages:
pip freeze > requirements.txt
4. Configure Twilio Credentials
Create a .env file 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
5. Run the App
uvicorn app.main:app --reload
π API Documentation
Swagger UI: http://127.0.0.1:8000/docs
ReDoc UI: http://127.0.0.1:8000/redoc
OTP Authentication with Twilio and FastAPI
A simple and scalable OTP (One-Time Password) authentication system for logging into web or mobile apps using FastAPI and Twilio.
π§ Features
π Getting Started
1. Clone the Repository