To ensure you can reach a users mobile no matter their location and network it's likely you're going to have to look at a paid service such as Nexmo (who I work for) or Twilio.
With these services you can either build your own verification (2FA - Two Factor Authentication) workflow:
- User enters their phone number in a form and submits to your app
- Your app receives the phone number
- You send the user an SMS with an auth code
- User receives the auth code
- User enters auth code into a form and submits to your app
- Your app receives the auth code and checks that auth code against the phone number (maybe using the current session phone number)
- If the auth code is the one you are expected then the user is validated
Or you can use their 2FA authentication products (Nexmo - Verify or Twilio - Authy that should help simplify this workflow.
Using Nexmo verify the code would be:
Send Verification Request
var Nexmo = require('nexmo');
var nexmo = new Nexmo({apiKey: API_KEY, apiSecret: API_SECRET});
var verifyRequestId = null; // use in the check process
nexmo.verify.request({number: TO_NUMBER, brand: APP_NAME}, function(err, result) {
if(err) { console.error(err); }
else {
verifyRequestId = result. request_id;
}
});
Check Authentication Code
nexmo.verify.control({request_id: verifyRequestId, cmd: 'cancel'}, function(err, result) {
if(err) { console.error(err); }
else {
console.log(result);
}
});