Phone Number Authentication using Node.js and Flutter
flutter-node-otp-phone-number-verification
Phone Number Authentication using Node.js, Flutter, and Vonage SMS Gateway Service API
Overview
This project demonstrates how to implement phone number authentication using Node.js, Flutter, and the Vonage SMS Gateway Service API. Phone number authentication provides a secure and convenient way for users to verify their identity during the login process.
Features
- Generate and send OTP via SMS to users for phone number verification.
- Validate the OTP entered by the user to authenticate their identity.
- Integration with the Vonage SMS Gateway Service API to send and receive SMS messages.
Technologies Used
- Node.js
- Flutter
- Vonage SMS Gateway Service API
Setup Instructions
Prerequisites
- Node.js should be installed on your machine.
- Flutter SDK should be installed.
- Sign up for a Vonage account and obtain the API key, API secret, and virtual phone number.
Backend (Node.js)
- Clone the repository:
git clone https://github.com/Danitilahun/flutter-node-otp-phone-number-verification.git
- Navigate to the
backend
directory:cd API
- Install dependencies:
npm install
- Configure the Vonage API credentials in the
.env
file. - Start the Node.js server:
npm start
Frontend (Flutter)
- Open the
otp_verification
directory in your preferred code editor. - Configure the backend server URL in the Flutter code.
- Run the Flutter application on a connected device or emulator:
flutter run
API Endpoints
POST /auth/send-otp
: Sends an OTP via SMS to the user’s phone number.POST /auth/verify-otp
: Verifies the OTP entered by the user.
Usage
- Launch the Flutter application on your device/emulator.
- Enter your phone number and click on the “Send OTP” button.
- Receive the OTP on your phone.
- Enter the OTP in the application and click on the “Verify” button.
- If the OTP is valid, the user is successfully authenticated.
Contributing
Contributions to this project are welcome. To contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your contribution:
git checkout -b feature/your-feature
. - Commit your changes:
git commit -m 'Add your commit message'
. - Push to the branch:
git push origin feature/your-feature
. - Open a pull request and describe the changes you have made.
License
This project is licensed under the MIT License.
Acknowledgements
- Vonage: Used for sending and receiving SMS messages.
Contact
For any questions or feedback, please reach out to Daniel Tilahun.