<@U04UQ68083H> Hi, Ory team. Is there any way to c...
# ory-copilot
w
@chilly-king-10285 Hi, Ory team. Is there any way to continue with the registration flow if the entity does not exist while trying to use the login flow in kratos? Currently, the registration flow by code method does not indicate if the entity exists until the flow is completed. For now, I am doing this manually, i.e., I am going through the login flow, and if the user does not exist, I proceed to registration. However, I am wondering if there is a way to keep them separate and get an error if the user already exists during the registration flow, or perhaps have a unified way to automatically continue with the registration flow if the user does not exist
c
A message from kapa.ai
In Ory Kratos, the registration and login flows are separate processes. When you initiate a registration flow, it doesn't check if the user already exists until the flow is completed. Similarly, the login flow doesn't automatically redirect to the registration flow if the user doesn't exist. However, you can retrieve an existing registration flow by sending a GET request that contains the flow ID to the
/self-service/registration/flows?id=<flow-id>
endpoint. The flow ID is stored in the
?flow=
URL query parameter in your application. Here's an example of how to get flow data using the flow ID:
Copy code
bash curl -X GET \       -H 'Content-Type: application/json' \       -H 'Accept: application/json' \       -c cookies.txt \       "https://{project.slug}.<http://projects.oryapis.com/self-service/registration/flows?id=<your-flow-id|projects.oryapis.com/self-service/registration/flows?id=<your-flow-id>>"
(Source: [Get registration flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#get-registration-flow)) If you want to show the verification flow directly after the user has registered, you can refer to the [registration documentation](https://www.ory.sh/docs/identities/sign-in/actions#show-verification-after-successful-registration). Please note that these processes are designed to be separate to ensure the security and privacy of user data. Combining them or creating a unified flow could potentially expose sensitive information or create security vulnerabilities.