Hi,
I am thinking of implementing an OTP-based login mechanism on my app.
I have a WhatsApp API provider using which I can send WhatsApp messages.
Here’s the flow I am thinking of:
- SIGN-UP
- The user enters relevant information like email, name, and phone and clicks on the request OTP. (I’ll be storing the number by appending with some domain to use it as an email.)
- I’ll then generate a random number using a backend workflow and store it in a custom state, and send this OTP to the user. (Is it safe to store this in a custom state? If not, where can I store it considering the user has not logged in yet?).
- Once he enters a valid OTP, I create a random hashed temporary password and use it to sign the user up. I also store this in the user database for future login
- LOGIN
- The user enters the phone number and clicks on the request OTP.
- I’ll then generate a random number using a backend workflow, store it in a custom state, and send this OTP to the user.
- Once he enters a valid OTP, I search the user table with his unique phone number and log him in with the temporary password created using step 4. (To do this search, I’ll have to disable privacy rules to get a temporary password. Is this secure?)
Can you please let me know if this is a good approach? If not, can you advise me on a better approach to implementing login and signup using OTP methods in Bubble?
Thanks
