Creating and authentication users only with mobile number and OTP

My usecase is

when user enters his/her mobile number they will receive an OTP for that mobile number,
If they are an existing user, they’ll be logged in to the application.

For OTP messaging service I’m using twilio.

How this can be done with Mongo DB realm.??
Is it possible to use the inbuilt twilio service in mongoDB realm as user authentication ???