# Allow only username and password field

**URL:** <https://community.auth0.com/t/allow-only-username-and-password-field/106779>\
**Category:** Get Help\
**Tags:** classic-universal-login-experience, login-experience\
**Created:** [May 11, 2023, 8:47pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779 "2023-05-11T20:47:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggautam-rev](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ggautam-rev](https://community.auth0.com/u/ggautam-rev)\
**Post date:** [May 11, 2023, 8:47pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779/1 "2023-05-11T20:47:37Z")

</div>

I have a use-case where I am required to only use the username(not company email address). When the redirection happens, it expects it to be only username. How do I modify the universal-login page to achieve this?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 12, 2023, 10:43pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779/3 "2023-05-12T22:43:48Z")

</div>

Hi @ggautam-rev,

Thanks for reaching out to the Auth0 Community!

> [@ggautam-rev](#):
>
> How do I modify the universal-login page to achieve this?

Unfortunately, it’s not possible to force the login page to require only the username. By default, when logging in with a database connection with the **Requires Username** feature enabled, the login page allows the user to provide either an **email address** or **username** to log in. This cannot be modified to require only the username. See below:

![image](https://global.discourse-cdn.com/auth0/original/3X/7/6/761b5f52a6229feeb9c3c38d2ee4e039ab669118.png)

As a workaround, you could ask the user for their username before redirecting them to the login page and passing it in the `login_hint` query parameter of the login URL. Doing so will prefill the `username/email` field with the username.

For example:

```auto
https://{yourDomain}/authorize?
    response_type=code&
    client_id={yourClientId}&
    redirect_uri={https://yourApp/callback}&
    scope={scope}&
    audience={apiAudience}&
    state={state}&
    login_hint={USERNAME}

```

I hope this helps!

Please let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![ggautam-rev](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ggautam-rev](https://community.auth0.com/u/ggautam-rev)\
**Post date:** [May 15, 2023, 12:47pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779/4 "2023-05-15T12:47:01Z")

</div>

Hi Rueben, Thanks for the reply. I was thinking somewhat similar where I would capture the username and then write some custom code to perform the redirect. However, I could not figure out how I would get the value of the state parameter in the above query. Can you please help?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 23, 2023, 9:22pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779/5 "2023-05-23T21:22:10Z")

</div>

Hi @ggautam-rev,

Thank you for your reply.

The `state` parameter is a unique and non-guessable value associated with each authentication request. If you are using one of our[Auth0 SDK’s](https://auth0.com/docs/libraries/), then you should be able to call the appropriate login method with the `login_hint` query parameter, and it will automatically generate the `state` parameter for you.

In case you would like to test the login functionality and don’t require a specific `state` value, you can pass a random string such as `state=xyzABC123` in your `state` parameter.

For more information about the `state` parameter, I recommend checking out our documentation on [State Parameters](https://auth0.com/docs/secure/attack-protection/state-parameters).

Please let me if there’s anything else I can do to help.

Thanks,  
Rueben

---

<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:** [June 6, 2023, 9:22pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779/6 "2023-06-06T21:22:35Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [August 19, 2024, 3:33pm UTC](https://community.auth0.com/t/allow-only-username-and-password-field/106779/7 "2024-08-19T15:33:35Z")

</div>

Hi team!

Updating this topic with our latest solution that makes it possible to create an account with flexible identifiers → [Activate and Configure Attributes for Flexible Identifiers](https://auth0.com/docs/authenticate/database-connections/activate-and-configure-attributes-for-flexible-identifiers). You can select between Email, Phone, or Username as Identifiers for your database connection.

Thanks  
Dawid
