Check user by username

I have a custom login page built using Next.js and the Auth0-js library. The page is configured under Branding > Universal Login > Login > Custom Login Page.

The sign-up process involves two steps. On the first step, new users are required to provide a username and additional metadata.

I’d like to implement a feature that checks for existing users with the same username before proceeding to the second step. If a user with the same username already exists, an error message should be displayed.

Could you please provide a detailed explanation of how to implement this feature?

Thank you in advance

Hi @serhii.holub,

Welcome back to the Auth0 Community!

Thank you for posting your question. Using flexible identifiers, you can add the username as a required field, which will pass the validation process on the Auth0 side. You can read more about that here → Flexible Identifiers and Attributes

If you make the username as required attribute alongside the email address, the user won’t be able to signup until they’ll provide the distinct username

Thanks
Dawid

Hi @dawid.matuszczyk

I’m using the auth0-js library’s webAuth.redirect.signupAndLogin method for the sign-up process.

Before submitting the form, is it possible to check if a user with the specified username already exists using an API call?

Thanks.

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