flaky-kilobyte-10585
02/06/2025, 9:29 AMbrief-egg-61061
02/06/2025, 9:29 AMbrief-egg-61061
02/06/2025, 9:30 AMyaml selfservice: methods: code: enabled: true config: lifespan: 15m flows: recovery: enabled: true lifespan: 15m use: code notify_unknown_recipients: false
This configuration enables the account recovery flow using the one-time code method, with a 15-minute lifespan for both the code and the recovery flow. For more detailed information on configuring and customizing the account recovery process, you can refer to the [Account recovery and password reset](https://www.ory.sh/docs/kratos/self-service/flows/account-recovery-password-reset) documentation.flaky-kilobyte-10585
02/06/2025, 9:30 AMbrief-egg-61061
02/06/2025, 9:30 AMbrief-egg-61061
02/06/2025, 9:31 AMbash curl --request POST -sL \ --header "Authorization: Bearer {ORY_API_KEY}" \ --header "Content-Type: application/json" \ --data '{ "schema_id": "<preset://email>", "traits": { "email": "$USER_EMAIL_ADDRESS" } }' https://{project-slug}.<http://projects.oryapis.com/admin/identities|projects.oryapis.com/admin/identities>
2. Get the ID of the created account from the API response. 3. Use the account ID to generate a recovery link: bash curl --request POST -sL \ --header "Authorization: Bearer {ORY_API_KEY}" \ --header "Content-Type: application/json" \ --data '{ "expires_in": "12h", "identity_id": "$ACCOUNT_ID" }' https://{project-slug}.<http://projects.oryapis.com/admin/recovery/link|projects.oryapis.com/admin/recovery/link>
4. Copy the recovery link from the API response and send it to the user. When the user clicks on the recovery link, they will be able to set a new password, effectively resetting their account. It's important to note that this process requires an API Key for authorization. Make sure you have the necessary permissions to perform these administrative actions. For more detailed information on this process, you can refer to the [Invite users](https://www.ory.sh/docs/kratos/manage-identities/invite-users) documentation, which outlines a similar process that can be adapted for password resets. Remember, this method bypasses the normal user-initiated recovery flow, so it should be used judiciously and in accordance with your organization's security policies.