rough-kilobyte-98919
08/21/2025, 1:43 AMbrief-egg-61061
08/21/2025, 1:43 AMbrief-egg-61061
08/21/2025, 1:43 AMcode
method and include the resend
field in your request. According to the API specification, the resend
property is available in the "Update Registration Flow with Code Method" and is used to restart the flow with a new code. Your request body should look like this: json { "method": "code", "traits": { /* your identity traits */ }, "csrf_token": "your-csrf-token", "resend": "true" }
- method
must be set to code
. - traits
should contain the identity's traits. - csrf_token
is required for browser flows. - resend
triggers the resend of the code. This will instruct Ory to resend the verification code as part of the registration flow using the code method [Ory API Reference – updateRegistrationFlow](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json). If you are using a custom UI, make sure to include a button or action that submits the registration flow with the resend
field set, as shown above. > Note: The knowledge sources do not provide a full example of the resend action in a UI, but the API contract clearly supports this field for the code method during registration.rough-kilobyte-98919
08/21/2025, 1:46 AMvalue must be \"code\""
. eventhough I passed in method: code
brief-egg-61061
08/21/2025, 1:46 AMbrief-egg-61061
08/21/2025, 1:46 AMvalue must be "code"
typically means that the value provided for the method
field in your request body is not exactly "code"
(as a string), or the field is missing. According to the Ory API specification, the method
field must be set to the string "code"
when using the code method for registration: json { "method": "code", "traits": { /* your identity traits */ }, "csrf_token": "your-csrf-token", "resend": "true" }
Please check the following: - Ensure that the method
field is present and its value is exactly "code"
(all lowercase, no extra spaces or quotes). - Make sure you are not sending the value as a boolean or any other type (e.g., not method: code
without quotes, or method: "Code"
with a capital "C"). - The request body must be valid JSON if you are using the application/json
content type. If you are still seeing the error, double-check the request payload and the content type header. The API expects: - method
(string, required): must be "code"
- traits
(object, required) - csrf_token
(string, required for browser flows) - resend
(string, optional) Reference: [Ory API Reference – updateRegistrationFlow](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json) If you are following these requirements and still encounter the error, please provide the exact request payload (with sensitive data redacted) for further troubleshooting.rough-kilobyte-98919
08/21/2025, 1:48 AMresend must be code
brief-egg-61061
08/21/2025, 1:48 AMbrief-egg-61061
08/21/2025, 1:48 AMresend
field to the string value "code"
in your request payload, not "true"
. Here is the correct request body format: json { "method": "code", "traits": { /* your identity traits */ }, "csrf_token": "your-csrf-token", "resend": "code" }
- method
must be "code"
. - traits
should contain the identity's traits. - csrf_token
is required for browser flows. - resend
must be set to "code"
to trigger the resend action. This is confirmed by the API schema, which describes the resend
field as a string and expects the value "code"
to restart the flow with a new code [Ory API Reference – updateRegistrationFlow](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json). If you use any other value for resend
, or omit it, the resend action will not be triggered and you may see the error you described.rough-kilobyte-98919
08/21/2025, 1:53 AMbrief-egg-61061
08/21/2025, 1:53 AMbrief-egg-61061
08/21/2025, 1:53 AM"code"
- `code`: the code received by the user - `csrf_token`: required for browser flows - `traits`: the identity's traits Here is an example request body: json { "method": "code", "code": "123456", "csrf_token": "your-csrf-token", "traits": { /* your identity traits */ } }
This will submit the code for verification as part of the registration flow. Make sure not to include the resend
field when you are verifying the code; it is only used to trigger a resend of the code [Ory API Reference – updateRegistrationFlow](https://raw.githubusercontent.com/ory/docs/master/docs/reference/api.json). If you need to verify a code for other flows (like verification or recovery), the process is similar: submit the code and required fields to the appropriate endpoint, following the same pattern as above.rough-kilobyte-98919
08/21/2025, 1:57 AMbrief-egg-61061
08/21/2025, 1:57 AMbrief-egg-61061
08/21/2025, 1:57 AMrough-kilobyte-98919
08/21/2025, 2:24 AMbrief-egg-61061
08/21/2025, 2:24 AMbrief-egg-61061
08/21/2025, 2:24 AMkratos.yml
) or the environment variable DSN
that is set when starting the Kratos service. The DSN is specified under the dsn
key in the configuration file, for example: yaml dsn: <postgres://kratos:password@localhost:5432/kratos?sslmode=disable>
Alternatively, if you are running Kratos via Docker, the DSN is often set as an environment variable: bash -e DSN=<postgres://kratos:password@localhost:5432/kratos?sslmode=disable>
or bash export DSN=...
and then referenced with the -e
flag in commands [Docker images](https://www.ory.sh/docs/kratos/guides/docker). To check the status of the database connection, you can use the Kratos health endpoints: - GET /health/alive
checks if the HTTP server is running (does not check the database connection). - GET /health/ready
checks if Kratos is running and if the environment dependencies (including the database) are responsive. A 200 OK response means the database connection is healthy; a 503 indicates issues [Ory Identities API - metadata](https://raw.githubusercontent.com/ory/kratos/master/spec/api.json). Example: bash curl <http://localhost:4433/health/ready>
A successful response: json {"status":"ok"}
indicates that Kratos is ready and the database connection is healthy. If you need to confirm the exact DSN at runtime, you must inspect the running configuration or environment variables, as Kratos does not expose the DSN via its API for security reasons.rough-kilobyte-98919
08/21/2025, 2:26 AMbrief-egg-61061
08/21/2025, 2:26 AMbrief-egg-61061
08/21/2025, 2:26 AM--config
flag (e.g., kratos --config path/to/kratos.yml
). You can open this file directly to see the current configuration, including the dsn
value [Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 2. Check environment variables: Environment variables take precedence over config file values. You can inspect the environment variables of the running Kratos process using standard OS tools (e.g., printenv
, env
, or by inspecting the process environment in your container/orchestration platform). The DSN is typically set as DSN=...
[Configuration](https://www.ory.sh/docs/ecosystem/configuring). 3. Note: Ory Kratos does not provide an API endpoint to directly expose the full running configuration or environment variables for security reasons. You must inspect these at the file or process level. If you are running Kratos in Docker, you can check the environment variables set in your docker run
command or docker-compose.yml
file. If running in Kubernetes, check your deployment manifests or use kubectl exec
to inspect the environment inside the running pod. > The knowledge sources do not mention any built-in Kratos API or CLI command to dump the full running configuration or environment variables at runtime.rough-kilobyte-98919
08/21/2025, 2:30 AMbrief-egg-61061
08/21/2025, 2:30 AMbrief-egg-61061
08/21/2025, 2:30 AMdsn
in your kratos.yml
but Ory Kratos does not seem to be connecting to the database, here are some steps to troubleshoot based on the official documentation: 1. Check for Environment Variable Override Environment variables take precedence over config file values. If you have set the DSN
environment variable (e.g., in your Docker Compose, shell, or deployment), it will override the value in kratos.yml
. Make sure there is no conflicting DSN
environment variable set [Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 2. Verify the Configuration File Path Ensure that Kratos is actually loading the correct configuration file. The config file path is specified with the --config
or -c
flag when starting Kratos. If the wrong file is loaded, your dsn
setting may be ignored [Reference: Configuration](https://www.ory.sh/docs/kratos/reference/configuration). 3. Check the DSN Format The DSN must be in the correct format for your database (e.g., PostgreSQL, MySQL). For example, for PostgreSQL: dsn: <postgres://user:password@host:5432/database?sslmode=disable>
[Self-hosted deployment](https://www.ory.sh/docs/self-hosted/deployment) 4. Check Kratos Logs Start Kratos with a higher log level (e.g., LOG_LEVEL=trace
) to get more information about connection attempts and errors. This can help you identify if there are authentication issues, network problems, or misconfigurations. 5. Test Database Connectivity Make sure your database is running and accessible from the environment where Kratos is running. You can test this by connecting to the database manually using the same credentials and host/port. 6. Check Health Endpoint Use the /health/ready
endpoint to check if Kratos is able to connect to the database: bash curl <http://localhost:4433/health/ready>
A 200 OK response means the database connection is healthy; a 503 indicates issues [Deploy to production](https://www.ory.sh/docs/kratos/guides/deploy-kratos-example#run-ory-kratos-using-systemd). If after these checks Kratos still does not connect to the database, review your startup command, environment, and logs for any errors or warnings related to configuration or database connectivity. > The knowledge sources do not provide a built-in Kratos API or CLI command to dump the effective configuration at runtime, so you must verify the config file and environment variables directly.rough-kilobyte-98919
08/21/2025, 2:31 AMbrief-egg-61061
08/21/2025, 2:31 AMbrief-egg-61061
08/21/2025, 2:32 AM/health/ready
endpoint returns ok
, it means Ory Kratos is able to connect to its configured database. However, this endpoint does not tell you which database (SQLite, Postgres, etc.) is being used. To determine whether Kratos is using SQLite (the default in many quickstarts) or your custom DSN, you need to: 1. Check your configuration file (kratos.yml
) for the dsn
value. For example: yaml dsn: <postgres://user:password@host:5432/database?sslmode=disable>
or yaml dsn: memory
or yaml dsn: sqlite:///tmp/some-db.sqlite?_fk=true
[Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring) 2. Check for environment variable overrides. If the DSN
environment variable is set, it will override the value in your config file. Environment variables take precedence over config file values [Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 3. Review your startup command. Ensure you are passing the correct config file to Kratos using the --config
or -c
flag, and that there are no conflicting environment variables. Kratos does not provide an API or CLI command to show the effective DSN at runtime. You must inspect the configuration and environment variables directly to be certain which database is in use. If you want to be sure, temporarily set an invalid DSN in your config or environment and restart Kratos—if the health endpoint fails, you know that DSN is being used. > The knowledge sources do not mention any built-in way to query the current DSN via API or logs, so manual inspection is required.rough-kilobyte-98919
08/21/2025, 2:33 AM<postgresql://postgres:admin@x.x.x.x?sslmode=disable>
brief-egg-61061
08/21/2025, 2:33 AMbrief-egg-61061
08/21/2025, 2:33 AM<postgres://user:password@host:port/database?sslmode=disable>
Based on your example, <postgresql://postgres:admin@x.x.x.x?sslmode=disable>
, there are a couple of issues: 1. Scheme: It should be postgres://
, not postgresql://
. 2. Database Name: You are missing the database name in the path section of the DSN. 3. Port: If you are not using the default port (5432), you should specify it. Example of a correct DSN: <postgres://postgres:admin@x.x.x.x:5432/kratos?sslmode=disable>
Replace kratos
with your actual database name. Reference: See the official documentation for the correct DSN format and examples: [Self-hosted deployment](https://www.ory.sh/docs/self-hosted/deployment#data-storage-and-persistence) [Deploy to production](https://www.ory.sh/docs/kratos/guides/deploy-kratos-example#install-ory-kratos) If your DSN does not match this format, Ory Kratos may not connect to your database as expected.rough-kilobyte-98919
08/21/2025, 2:43 AMbrief-egg-61061
08/21/2025, 2:44 AMbrief-egg-61061
08/21/2025, 2:44 AMdsn
in your configuration but Ory Kratos is still not connecting to your database—and the flows are still working—this strongly suggests that Kratos is not using your intended database configuration. Instead, it is likely falling back to an in-memory or SQLite database. Here are the most probable reasons, based on the official documentation: 1. Environment Variable Override: Environment variables take precedence over config file values. If the DSN
environment variable is set (for example, in your Docker Compose, shell, or deployment), it will override the value in your kratos.yml
. Double-check that there is no DSN
environment variable set elsewhere that points to memory
or sqlite
[Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 2. Incorrect Configuration File Path: Ensure that Kratos is loading the correct configuration file. The config file path must be specified with the --config
or -c
flag when starting Kratos. If the wrong file is loaded, your dsn
setting may be ignored [Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 3. Default to Memory/SQLite: If Kratos cannot connect to the specified database (e.g., due to a malformed DSN or network issue), it may fail to start or, in some setups, default to an in-memory database. If the flows are working but no data is persisted after a restart, this is a strong indicator that Kratos is using in-memory storage [Self-hosted deployment](https://www.ory.sh/docs/self-hosted/deployment#sqlite). 4. Check the DSN Format: The DSN must be in the correct format. For PostgreSQL, it should look like: <postgres://user:password@host:port/database?sslmode=disable>
If the DSN is malformed or missing the database name, Kratos will not connect to your intended database [Self-hosted deployment](https://www.ory.sh/docs/self-hosted/deployment#data-storage-and-persistence). What you should do: - Double-check for any DSN
environment variable overrides. - Confirm the config file path used at startup. - Ensure your DSN is correctly formatted and points to a reachable database. - Check if your data persists after restarting Kratos. If not, it is using in-memory storage. > The knowledge sources do not mention any built-in Kratos API or CLI command to show the effective DSN at runtime, so you must verify the config file and environment variables directly. If you need further troubleshooting, increase the log level (e.g., LOG_LEVEL=trace
) to see more details about database connection attempts in the logs [Go to production](https://www.ory.sh/docs/kratos/guides/production).rough-kilobyte-98919
08/21/2025, 2:54 AMbrief-egg-61061
08/21/2025, 2:54 AMbrief-egg-61061
08/21/2025, 2:54 AMDSN
environment variable takes precedence over the value in your kratos.yml
configuration file. If DSN
is set to memory
or another value elsewhere (such as in your environment, Docker Compose, or deployment scripts), Kratos will use that instead of your config file setting [Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 2. Incorrect Configuration File Usage: Kratos must be started with the correct configuration file using the --config
or -c
flag. If the wrong file is loaded, or if the file is not being loaded at all, your dsn
setting will not be applied [Configure Ory Kratos](https://www.ory.sh/docs/kratos/configuring). 3. Malformed DSN or Connection Issues: If the DSN is not in the correct format or the database is unreachable, Kratos may fail to connect and could fall back to in-memory storage, especially in development or quickstart setups [Self-hosted deployment](https://www.ory.sh/docs/self-hosted/deployment#sqlite). What to do next: - Double-check that no DSN
environment variable is set to memory
or another value. - Ensure you are starting Kratos with the correct config file. - Verify your DSN is correctly formatted and the database is reachable. > The knowledge sources do not mention any built-in Kratos API or CLI command to display the effective DSN at runtime, so you must verify the config file and environment variables directly. If you continue to experience issues, increase the log level to get more details about the database connection process.rough-kilobyte-98919
08/21/2025, 6:50 AMbrief-egg-61061
08/21/2025, 6:50 AMbrief-egg-61061
08/21/2025, 6:50 AMrough-kilobyte-98919
08/21/2025, 7:09 AMbrief-egg-61061
08/21/2025, 7:09 AMbrief-egg-61061
08/21/2025, 7:10 AM<http://ory.bar.com|ory.bar.com>
and <http://app.bar.com|app.bar.com>
will work; > - <http://ory.bar.com|ory.bar.com>
and <http://bar.com|bar.com>
will work; > - <http://ory.bar.com|ory.bar.com>
and <http://not-bar.com|not-bar.com>
will not work. > > [Self-service flows](https://www.ory.sh/docs/kratos/self-service#browser-flows-for-server-side-apps-nodejs-php-java-) This requirement is repeated throughout the documentation for all browser-based flows, including login, registration, and settings [Login flow](https://www.ory.sh/docs/kratos/self-service/flows/user-login#initialize-login-flow) [Registration flow](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#initialize-registration-flow) [Settings flow](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#initialize-settings-flow). If you attempt to use browser-based flows across different top-level domains, cookies will not be shared, and the flows will not work as intended. For multi-domain scenarios, Ory recommends using OpenID Connect (OIDC) for federated authentication, but even then, each domain will have its own session due to browser security constraints [Multiple custom domains](https://www.ory.sh/docs/kratos/bring-your-own-ui/configure-ory-to-use-your-ui#multiple-custom-domains). In summary: It is a hard requirement for browser-based flows that Ory and your UI are on the same top-level domain. This is not just a recommendation, but a technical and security necessity enforced by browser behavior and Ory’s security model.