Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ittovate/demo-otp-service
This project demonstrates an OTP (One-Time Password) service built with Spring Boot and Twilio. The service generates and sends OTPs via SMS to users for authentication purposes.
https://github.com/ittovate/demo-otp-service
maven spring twilio
Last synced: about 2 months ago
JSON representation
This project demonstrates an OTP (One-Time Password) service built with Spring Boot and Twilio. The service generates and sends OTPs via SMS to users for authentication purposes.
- Host: GitHub
- URL: https://github.com/ittovate/demo-otp-service
- Owner: ittovate
- Created: 2024-07-14T15:14:56.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-09-30T12:30:55.000Z (3 months ago)
- Last Synced: 2024-11-08T11:14:29.823Z (about 2 months ago)
- Topics: maven, spring, twilio
- Language: Java
- Homepage:
- Size: 376 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: docs/README.md
Awesome Lists containing this project
README
# ⚫ Introduction
- This is an OTP (One Time Password) service built using Spring Boot.
- It leverages Twilio for sending OTPs via SMS and Redis for storing OTPs with an expiration time.
- This service is designed to be simple, and easy to configure.### Key Features:
- **Twilio Integration**: Send OTPs via SMS to users.
- **Redis Cache**: Securely store OTPs with a predefined expiration time.
- **Swagger UI**: Interactive API documentation for easy testing and interaction.### Visual Representation
- The following video demonstrates how to interact with the application:
- **Left window**: Using Swagger UI to send and verify OTP.
- **Right window**: [PhoneLink](https://www.microsoft.com/en-us/windows/sync-across-your-devices?r=1) app to show recieved OTP on phone.
# 🔴 Prerequisites
- **Java 21.0.3**: Required to build and run the Spring Boot applications.
- **Apache Maven 3.9.8**: Used for dependency management and building the project.
- **Spring Boot 3.3.1**: Framework for building the Kafka producer and consumer demos.
- Redis Account (along with a created database).
- Twilio Account (along with your verified number).# ⚡ Running the Project
1. **Clone the repository**:
```bash
git clone https://github.com/ittovate/otp-service.git
```2. **Navigate to the project directory**:
```bash
cd demo-otp-service
```3. **Configure environment variables**:
1. Duplicate `src/main/resources/keys.env` file and rename the copy to `.env`.
2. Fill fields with values from your Twilio account and Redis account:
- `TWILIO_API_KEY` is "Accound SID" under "Account Info" section in https://console.twilio.com/.
- `TWILIO_API_TOKEN` is "Auth Token" under "Account Info" section in https://console.twilio.com/.
- `TWILIO_SENDER_NUMBER` is "My Twilio phone number" under "Account Info" section in https://console.twilio.com/.
- `TWILIO_VERIFIED_NUMBER` is your verified number used in your Twilio account.
- `REDIS_HOST` & `REDIS_PORT` are "Public endpoint" under "General" section (in the database settings).
- `REDIS_PASSWORD` is under "Security" section (in the database settings).
-
4. **Build and run the project**:
```bash
mvn clean install spring-boot:run
```5. [**Try it out!**](http://localhost:8080/swagger-ui/index.html)
6. **Stop the project**: After testing, stop demo by pressing `CTRL + C` in terminal.