<@U04UQ68083H> How can I create a Kratos verificat...
# ory-copilot
f
@chilly-king-10285 How can I create a Kratos verification flow from back-end ? Is it possible ?
c
A message from kapa.ai
Yes, it is possible to create a Kratos verification flow from the back-end. The verification flow is used to verify a user's account through their email address. There are two methods for this:
link
and
code
. For browser applications, you should use the
/self-service/verification/browser
endpoint. Here is an example of how to do this with a cURL command:
Copy code
bash curl -H 'Content-Type: application/json' \    -H 'Accept: application/json' \    -c cookies.txt \    https://{project.slug}.<http://projects.oryapis.com/self-service/verification/browser|projects.oryapis.com/self-service/verification/browser>
(Source: [Ory Documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration)) For native applications, you should use the
/self-service/verification/api
endpoint. Here is an example of how to do this in TypeScript:
Copy code
typescript import { Configuration, FrontendApi } from "@ory/client"      const frontend = new FrontendApi(    new Configuration({    basePath: `https://${process.env.ORY_PROJECT_SLUG}.<http://projects.oryapis.com|projects.oryapis.com>`,    }),   )      export async function createVerification() {    return await frontend.createNativeVerificationFlow()   }
(Source: [Ory Documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration)) Please note that these endpoints do not require authentication ([Ory API Reference](https://www.ory.sh/docs/kratos/reference/api)).
f
In your reponse you just show me endpoints for browser and native app. What is the endpoint that back-end can use ?
@chilly-king-10285 In your response you just show me endpoints for browser and native app. What is the endpoint that back-end can use ?
c
A message from kapa.ai
I apologize for the confusion. Based on the provided extracts, the Ory Kratos API provides two endpoints for initiating a verification flow: one for browser clients (
/self-service/verification/browser
) and one for native apps (
/self-service/verification/api
). However, the documentation specifically mentions that the
/self-service/verification/api
endpoint should not be used in server-side applications like NodeJS, PHP, Golang, etc., as it could make your application vulnerable to CSRF attacks. This endpoint is intended only for native mobile apps. Unfortunately, the provided extracts do not mention a specific endpoint for initiating a verification flow from a back-end server. It's recommended to refer to the [Ory Kratos API documentation](https://www.ory.sh/docs/kratos/reference/api) for more detailed information.