best-plumber-65600
04/09/2025, 3:09 AMbrief-egg-61061
04/09/2025, 3:09 AMbrief-egg-61061
04/09/2025, 3:10 AMresend
parameter. Based on the knowledge sources, here's how to do it: ## For Registration Flow When using the code method for registration, you can resend the code by including the resend
parameter in your request: json { "method": "code", "resend": "code", "traits": { // your identity traits here } }
The resend
parameter restarts the flow with a new code while maintaining the same flow ID [Ory API Reference](https://www.ory.sh/docs/reference/api). ## For Recovery Flow For recovery flows, you can resend the code by submitting a request with the email
field: json { "method": "code", "email": "<mailto:user@example.com|user@example.com>" }
In the UI, this is typically represented by a "Resend code" button that submits the email value [Docs > Kratos > Bring-your-own-ui > Integration basics > Recovery](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-recovery-flow). ## For Verification Flow Similarly for verification flows, you can resend the code by submitting a request with the email field: json { "method": "code", "email": "<mailto:user@example.com|user@example.com>" }
The UI typically includes a "Resend code" button that submits this request [Docs > Kratos > Bring-your-own-ui > Integration basics > Verification flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-verification-flow). Note that there is a known issue with the UI node grouping for recovery flow (GitHub issue #3980) where trying to resend a code fails since the code is required, which creates a poor user experience. This issue has been reported in Kratos version 1.2.0 [Github Issue (open): Incorrect UI Node Grouping For Recovery Flow](https://github.com/ory/kratos/issues/3980).best-plumber-65600
04/09/2025, 3:26 AMbrief-egg-61061
04/09/2025, 3:26 AMbrief-egg-61061
04/09/2025, 3:27 AMbest-plumber-65600
04/09/2025, 7:23 AMbrief-egg-61061
04/09/2025, 7:23 AMbrief-egg-61061
04/09/2025, 7:23 AMlifespan
parameter in your configuration: yaml selfservice: methods: code: enabled: true config: # Defines how long the verification or recovery code is valid for lifespan: 1m # Set to 1 minute
This configuration applies to both verification and recovery flows when using the code method. ### Specific Flow Configuration You can also set the lifespan for specific flows: For verification flows: yaml selfservice: flows: verification: use: code enabled: true lifespan: 1m # Flow UI interaction lifespan
For recovery flows: yaml selfservice: flows: recovery: enabled: true lifespan: 1m use: code
### How to Update Configuration You can update this configuration using the Ory CLI: 1. Download your current configuration: ory get identity-config --project <project-id> --workspace <workspace-id> --format yaml > identity-config.yaml
2. Update the configuration with the 1-minute lifespan 3. Apply the updated configuration: ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml
This will set your OTP code to expire after 1 minute as requested. [Docs > Kratos > Self-service > Flows > Account recovery and password reset](https://www.ory.sh/docs/kratos/self-service/flows/account-recovery-password-reset#configuration) [Docs > Kratos > Self-service > Flows > Address verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation)best-plumber-65600
04/09/2025, 7:24 AMbrief-egg-61061
04/09/2025, 7:25 AMbrief-egg-61061
04/09/2025, 7:25 AMyaml selfservice: flows: registration: lifespan: 1m # Set to 1 minute enabled: true
This configuration controls how long the registration flow (the UI interaction) remains valid. After this period expires, users will see an error message like "The registration flow expired 1.00 minutes ago, please try again. (4040001)" and will need to restart the registration process. ### Implementation Details When a registration flow expires, Ory Kratos returns an error message with ID 4040001 as documented in [Docs > Kratos > Concepts > ui-messages](https://www.ory.sh/docs/kratos/concepts/ui-messages#the-registration-flow-expired-100-minutes-ago-please-try-again-4040001). Note that this is different from the code expiration time. The registration flow lifespan controls how long the entire registration UI interaction can last, while the code lifespan (if you're using the code method) controls how long the verification code itself is valid. To update this configuration using the Ory CLI, follow the same process as before: 1. Download your current configuration 2. Update the registration lifespan value 3. Apply the updated configuration This will set your registration flow to expire after the specified time period.best-plumber-65600
04/09/2025, 8:48 AMbrief-egg-61061
04/09/2025, 8:48 AMbrief-egg-61061
04/09/2025, 8:48 AM