Allow me to present an idea involving automated OTP verifications for various purposes, including password recovery.
Requirements:
1. Backend Server
2. SMS Server
3. Ionic app
4. Understanding of REST API
You have the option to set up two REST API URLs that will prompt the backend to send the SMS OTP. Here is an example:
1. /sendOtp - a backend API that Ionic calls to send the OTP
Ionic app -> sendOTP API -> SMS server -> Ionic app
a. Ionic app: Sends information like phone number and type (e.g., reset-password) along with a generated reference code.
b. sendOTP API: Generates a 6-digit OTP, saves it in the database, and sends it to the SMS server.
c. SMS server: Sends the OTP to the provided phone number.
d. Ionic app: Displays the OTP page while waiting for the OTP.
2. /verifyOtp - a backend API that verifies the OTP generated from the backend and matches it to the database.
Ionic app -> verifyOtp API -> SMS server -> Ionic app
a. Ionic app: Upon receiving the OTP digits, it sends the OTP along with the reference code to the verifyOtp API.
b. verifyOtp API: Accepts and checks if the OTP matches the database, then generates a temporary password.
c. SMS Server: Sends the temporary password to the Ionic app.
d. Ionic app: Can display a thank you page or redirect to a password change screen.
You can design the APIs based on your specific requirements.