# Lock SMS or Email

**URL:** <https://community.auth0.com/t/lock-sms-or-email/6979>\
**Category:** Get Help\
**Tags:** email, sms, passwordless, lock\
**Created:** [June 8, 2017, 8:50pm UTC](https://community.auth0.com/t/lock-sms-or-email/6979 "2017-06-08T20:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.ormrod](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/michael.ormrod/32/7214_2.png) [@michael.ormrod](https://community.auth0.com/u/michael.ormrod)\
**Post date:** [June 8, 2017, 8:50pm UTC](https://community.auth0.com/t/lock-sms-or-email/6979/1 "2017-06-08T20:50:09Z")

</div>

Hi,

We want to enable a user to receive the code by email or SMS

Has anybody implemented anything like this?

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [June 9, 2017, 6:15am UTC](https://community.auth0.com/t/lock-sms-or-email/6979/2 "2017-06-09T06:15:36Z")

</div>

The Passwordless Lock widget does not support toggling between the two methods within the Lock UI. However, you can handle this by showing the correct Lock UI based on how the login was initiated. For example, you could have two buttons on your UI (e.g. Login with email, Login with SMS), and show the relevant Lock UI based on which was clicked:

```
HTML
<button onclick="loginEmail()">Login with Email</button>
<button onclick="loginSMS()">Login with SMS</button>

JS
function loginEmail(){
	lock.emailcode();
}

function loginSMS(){
    //Open the lock in SMS mode with the ability to handle the authentication in page
	lock.sms(appearanceOpts,function (error, profile, id_token, access_token, state, refresh_token) {
		if (!error) {
			//usually save profile and id_token
			console.log(id_token);
			console.log(JSON.stringify(profile));
		 }
    });
}

```

---

<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:54am UTC](https://community.auth0.com/t/lock-sms-or-email/6979/3 "2018-03-02T05:54:30Z")

</div>


