Skip to main content


In this section, we will see how we can customise this recipe to add username based login with an optional email field to your application.

There are a few variations on how username based flows can work:

  • Only username and password login: The user signs up and signs in with a username and a password. Password reset flows requires contacting support.
  • Username and password login with optional email: The user has to sign up with a username and password, and may provide their email if they want. They may sign in with either username or email. Password reset flows will use the email if the user has one, else it will be a contact support based flow.
  • Username, email and password login: Here the user has to provide a username, email and password during sign up. Sign in may be via username or email. Password reset flows use the email.

In this guide, we will show you how to implement the second flow: "Username and password login with optional email". If you are using one of the other options, you can still follow this guide and make tweaks on parts of it to achieve your desired flow.

Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI