When a user registers their mobile number during sign up, how can we verify that they really own the mobile number?


A lot of websites send a 4-digit or 6-digit one-time code to a mobile number via SMS or phone call when the user registers a mobile number on the website?

Is this a secure way to validate the ownership of mobile number? Are there any issues with it?

If it is not secure, are there any better alternatives?