# Pre-User Registration Hook for Phone Number short/verification code

**URL:** <https://community.auth0.com/t/pre-user-registration-hook-for-phone-number-short-verification-code/8448>\
**Category:** Get Help\
**Tags:** pre-user-registratio, signup\
**Created:** [October 11, 2017, 12:48pm UTC](https://community.auth0.com/t/pre-user-registration-hook-for-phone-number-short-verification-code/8448 "2017-10-11T12:48:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidhong85](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@davidhong85](https://community.auth0.com/u/davidhong85)\
**Post date:** [October 11, 2017, 12:48pm UTC](https://community.auth0.com/t/pre-user-registration-hook-for-phone-number-short-verification-code/8448/1 "2017-10-11T12:48:57Z")

</div>

I’m building a Android and I would like to use Phone Number as Username instead of email with a password.  
During user registration process, a SMS verification code should send to the user’s Phone and then user can activate their User Account by entering the same verification code on my Android App.

**Apply Phone Number format Validation as part of Username similar to Passwordless**

- Any Rules example to apply this Validation during User Registration?
- Any javascript example can be applied on Hosted Page?

**Generate verification code and sending SMS**

- Does Hooks features is correct way to generate random 4 digit number and store against customer User.metadata.verificationcode (String), User.metadata.phonenumberverified (Boolean)
- In term of sending SMS, i will create a WebTask which accept Phone Number/Verification Code and execute this WebTask request upon Pre-User Registration Hook.

**User Account Activation via Verification Code**

- By assuming i store verification code on User.metadata.verificationcode, i will then create WebTask that accept ID Token and Verification Code. If found a match, i will set User.metadata.phonenumberverified (Boolean) as True, else reject.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/pre-user-registration-hook-for-phone-number-short-verification-code/8448/2 "2018-03-02T05:56:55Z")

</div>


