#4456·kratos

Unified code login and register as one flow

Author: amirsalarsafaeiCreated Aug 3, 2025Updated Sep 26, 2026
Labelsfeat

Preflight checklist

Ory Network Project

No response

Describe your problem

Following our positive experience self-hosting Ory Hydra as our OAuth2 server, our organization is now planning to self-host Ory Kratos. The primary challenge we've encountered is the lack of a unified login and registration flow. For our use case, which solely relies on phone numbers and SMS codes, this separation creates a security vulnerability by enabling account enumeration, which could allow an attacker to determine which phone numbers are registered with our service. I noticed this topic was previously discussed in the stale, closed issue #2984.

Describe your ideal solution

I believe a unified flow should be implemented for SMS/email code verification, or Kratos should at least provide the flexibility to manage this logic within hooks. Currently, the system returns an error when the phone number does not exist, preventing a seamless user transition to registration. I am willing to contribute to developing a solution with some guidance from the maintainers. I understand that a universal solution could introduce other security risks, which is why I am specifically proposing this for code-based verification methods.

Workarounds or alternatives

The only workaround I have considered is to handle this logic on the client side. This approach would involve interpreting the specific error code returned when a user is not found and then switching the UI from the login flow to the registration flow. I don't believe this is a good solution

Version

latest

Additional Context

No response