New Ory Agent Security is now live! Claim your complimentary test drive. Get Started!

Skip to main content

Identifier first authentication

Identifier first authentication first requests the user's identifier such as an email or username before prompting for a password or other authentication methods.

note

Identifier first authentication is required when using B2B Organization login.

This guide explains how to enable and use identifier first authentication in Ory Network and self-hosted Ory Kratos.

Ory Network​

To enable it:

    1. Log in to the Ory Console.
    1. Select your project.
    1. Navigate to Branding → Theming in the Ory Console.
    1. Disable "Use legacy Hosted UI".
    1. Test the flow in your application by navigating to the login page.

To revert, follow the same steps, enable "Use legacy Hosted UI", and click "Reset to Account Experience" on the Branding → UI URLs in the Ory Console.

Self-hosted Ory Kratos​

For Ory Enterprise License and Ory Apache 2.0 License users, set the following configuration in your kratos.yaml config file:

kratos-config.yaml
selfservice:
flows:
login:
style: identifier_first

To disable this feature, set style to unified.

Account enumeration mitigation​

Account enumeration mitigation prevents malicious actors from being able to identify if a user exists or not.

By default, Ory does not prevent account enumeration in the identifier first authentication flow. This improves user experience as the user quickly knows if they have an account with the chosen identifier (email / username) or not. To enable account enumeration, use the Ory CLI patch command

ory patch identity-config --project <project-id> --add '/security/account_enumeration/mitigate=true'

or if you use a config file, add the following to your kratos.yaml config file:

kratos-config.yaml
security:
account_enumeration:
mitigate: true

Sign-in with a one-time code​

With account enumeration mitigation enabled, sign-in with a one-time code responds the same way whether or not the identifier belongs to an account that can sign in with a code:

  • Every identifier gets the same next screen, either the sign-in method selection or the code entry screen.
  • Ory sends a code only if the identifier belongs to an account that can sign in with a code. For any other identifier, the code entry screen appears, but no code is sent.
  • Entering a code for an identifier without such an account fails with the same error as a wrong code.

Organizations​

With account enumeration mitigation enabled, Ory handles organization members the same way as any other identifier:

  • Sign-in shows an organization's SSO providers only when the email domain of the identifier is one of the organization's domains, or when the flow was started with the organization query parameter. Organization members whose email address is on a different domain must start sign-in with the organization query parameter.
  • Account recovery answers a request for an organization member like a request for any other address and sends the recovery code or link. Using it does not sign the member in, unless it was sent to a break-glass address.