Authenticate users in MongoDB Realm app with Mobile Number and OTP

The app I am developing is for users who are non-technical and who mostly use Android phones. Almost all of them use Whatsapp. I also want to provide them whatsapp like authentication.
In the MongoDB Realm documentation there is no mention of Mobile Number and OTP authentication. As per my understanding I need to use Custom Functions for it. The steps would be:
1. A custom function to send otp to the user using twilio api
2. A custom function to match the otp and return the success/failure message to mobile client.
3. A custom function to change the Mobile number of the user.
I am novice in the MongoDB Realm development and not confident that the steps mentioned above are sufficient. How can I successfully implement the OTP authentication in the Mobile App?

This can all be done in the same custom function, but yes, that pretty much sums up what you need to do. You might also want to consider just integrating with a 3rd party service that provides sms authentication, such as auth0 or Firebase. If you decide to use auth0, you can then configure the custom jwt provider to respect the tokens signed by auth0. This tutorial goes over integrating auth0 with MongoDB Stitch (the old name for MongoDB Realm) and should hopefully point you in the right direction.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.