full-notebook-65880
07/27/2024, 6:57 AMchilly-king-10285
07/27/2024, 6:57 AMchilly-king-10285
07/27/2024, 6:57 AMlink 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: 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: 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: 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).