<@U04UQ68083H> please explain me recovery flow for...
# ory-copilot
f
@chilly-king-10285 please explain me recovery flow for flutter/native
c
A message from kapa.ai
The recovery flow in Ory allows users to recover access to their accounts. It is used in conjunction with the settings flow. When a recovery flow is submitted, a session is issued to the application, allowing the user to reset their password and update their profile information on the settings page. There are two methods for the recovery flow:
link
and
code
. - The
link
method requires the user to open the recovery link from their email client using a browser on the same device. - The
code
method is more user-friendly as the code can be entered on the same device where the user requested the code from. This is the preferred method as spam filters and email clients can invalidate recovery links. Only one recovery method can be enabled at a time. The
code
method is enabled by default in all new Ory Network projects. For native applications, you must use the
/self-service/recovery/api
endpoint to create a recovery flow. Here is an example of how to create a recovery flow using cURL:
Copy code
bash curl -H 'Content-Type: application/json' \       -H 'Accept: application/json' \       "https://$<http://PROJECT_SLUG.projects.oryapis.com/self-service/recovery/api|PROJECT_SLUG.projects.oryapis.com/self-service/recovery/api>"
To get the recovery flow, you can use the following cURL command:
Copy code
bash curl -H 'Content-Type: application/json' \       -H 'Accept: application/json' \       "https://$<http://PROJECT_SLUG.projects.oryapis.com/self-service/recovery/flows?id=<your-flow-id|PROJECT_SLUG.projects.oryapis.com/self-service/recovery/flows?id=<your-flow-id>>"
To submit the recovery flow, you can use the following cURL command:
Copy code
bash curl -X POST \       -H 'Content-Type: application/json' \       -H 'Accept: application/json' \       -d '{"method":"code","email":"[[email protected]](<https://www.ory.sh/cdn-cgi/l/email-protection>)"}' \       "https://$<http://PROJECT_SLUG.projects.oryapis.com/self-service/recovery?flow=<your-flow-id|PROJECT_SLUG.projects.oryapis.com/self-service/recovery?flow=<your-flow-id>>"
Please replace
$PROJECT_SLUG
and
<your-flow-id>
with your actual project slug and flow id respectively. For more details, please refer to the [Ory documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#recovery).