您好我正在开发一个需要自动otp验证的项目,一旦用户输入电话号码,我已经在互联网上查看过,离子1角度的示例是1.我需要带有typescript的离子3的示例。请帮助我举了一些例子。
答案 0 :(得分:0)
我会给您一个想法,以及如何进行自动otp验证。有时会使用忘记的密码
Pre requisites:
1. Backend Server
2. SMS Server
3. Ionic app
4. Idea on REST API
您可以设置两个restapi url,这些URL触发了后端以向我的示例发送SMS OTP。
1. /sendOtp - backend api which ionic call to send the OTP
ionic app -> sendOTP api -> SMS server -> ionic app.
a. ionic app : send info like phone number, type ex. reset-password and generated reference code
b. sendOTP api : it will generate a 6 digit otp and save in the database and send to SMS server
c. SMS server : it will send to phone number
d. ionic app : it will open otp page while waiting the OTP
2. /verifyOtp - backend api which verify the otp generated from backend and match to the database.
ionic app -> verifyOtp api -> SMS server -> ionic app
a. ionic app : after receiving the otp digit i will send the otp with reference code to verifyOtp api
b. verifyOtp api : i will accept and check if will match in the database and generate temporary password
c. SMS Server : i will send the temporary password to the ionic app.
d. ionic app : you can prompt thank you page or redirect to change password
您可以根据需要设计api。