<@U04UQ68083H> Is this identity schema correct for...
# ory-copilot
m
@chilly-king-10285 Is this identity schema correct for email verification
Copy code
{
  "$id": "<https://schemas.ory.sh/presets/kratos/quickstart/email-password/identity.schema.json>",
  "$schema": "<http://json-schema.org/draft-07/schema#>",
  "title": "Person",
  "type": "object",
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "title": "E-Mail",
          "minLength": 3,
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              },
              "verification": {
                "via": "email"
              }
            },
            "verification": {
              "via": "email"
            },
            "recovery": {
              "via": "email"
            }
          }
        },
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "title": "First Name",
              "type": "string"
            },
            "last": {
              "title": "Last Name",
              "type": "string"
            }
          }
        }
      },
      "required": [
        "email"
      ],
      "additionalProperties": false
    }
  }
}
c
A message from kapa.ai
New message text here
m
@chilly-king-10285 I'm getting this error for my identity schema
Copy code
{"audience":"application","error":{"message":"I[#] S[#/allOf/1] allOf failed\n I[#/properties/traits/properties/email] S[#/allOf/1/properties/properties/properties/traits/properties/properties/patternProperties/.%2A/allOf/0] allOf failed\n I[#/properties/traits/properties/email] S[#/allOf/1/properties/properties/properties/traits/properties/properties/patternProperties/.%2A/allOf/0/$ref] doesn't validate with \"<ory://identity-extension#>\"\n I[#/properties/traits/properties/email] S[#/allOf/0] allOf failed\n I[#/properties/traits/properties/email/ory.sh~1kratos/credentials] S[#/allOf/0/properties/ory.sh~1kratos/properties/credentials/additionalProperties] additionalProperties \"verification\" not allowed","stack_trace":"\<http://ngithub.com/ory/kratos/driver/config.(*Config).validateIdentitySchemas|ngithub.com/ory/kratos/driver/config.(*Config).validateIdentitySchemas>\n\t/project/driver/config/config.go:450\ngithub.com/ory/kratos/driver/config.New\n\t/project/driver/config/config.go:368\ngithub.com/ory/kratos/driver.NewWithoutInit\n\t/project/driver/factory.go:41\ngithub.com/ory/kratos/driver.New\n\t/project/driver/factory.go:18\ngithub.com/ory/kratos/cmd/serve.NewServeCmd.func1\n\t/project/cmd/serve/root.go:26\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992\ngithub.com/ory/kratos/cmd.Execute\n\t/project/cmd/root.go:61\nmain.main\n\t/project/main.go:21\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1598"},"level":"error","msg":"Unable to instantiate configuration.","service_name":"Ory Kratos","service_version":"v1.0.0","time":"2023-11-17T13:19:18.501426657Z"}
c
A message from kapa.ai
The error message you're seeing is related to the validation of your identity schema. It seems like there's an issue with the
"verification"
property under
"credentials"
in your schema. Here is the relevant part of the error message:
Copy code
json "I[#/properties/traits/properties/email/ory.sh~1kratos/credentials] S[#/allOf/0/properties/ory.sh~1kratos/properties/credentials/additionalProperties] additionalProperties \"verification\" not allowed"
This suggests that the
"verification"
property is not allowed under
"credentials"
in your schema. In the [Ory Identity Schema](https://www.ory.sh/docs/kratos/manage-identities/identity-schema) documentation, the
"verification"
property is not listed under
"credentials"
. Instead, it should be a separate property under
"<http://ory.sh/kratos|ory.sh/kratos>"
. Here is an example of how it should look:
Copy code
json "email": {{   "type": "string",   "format": "email",   "title": "E-Mail",   "minLength": 3,   "<http://ory.sh/kratos|ory.sh/kratos>": {{     "credentials": {{       "password": {{         "identifier": true       }}     }},     "verification": {{       "via": "email"     }},     "recovery": {{       "via": "email"     }}   }} }}
Please adjust your schema accordingly and try again. If the problem persists, you might want to check the rest of your schema for any other inconsistencies or errors.
m
@chilly-king-10285 How to re request a new flow?
Copy code
{
  "id": "f385d3cc-9f92-46a4-83e2-dcc57d39ba6a",
  "type": "browser",
  "expires_at": "2023-11-17T14:29:18Z",
  "issued_at": "2023-11-17T13:29:18Z",
  "request_url": "<http://api2.dua-dev-app.com/self-service/registration/api?return_to=>",
  "active": "code",
  "ui": {
    "action": "<https://api2.dua-dev-app.com/kratos/self-service/verification?flow=f385d3cc-9f92-46a4-83e2-dcc57d39ba6a>",
    "method": "POST",
    "nodes": [
      {
        "type": "input",
        "group": "code",
        "attributes": {
          "name": "email",
          "type": "email",
          "required": true,
          "disabled": false,
          "node_type": "input"
        },
        "messages": [],
        "meta": {
          "label": {
            "id": 1070007,
            "text": "Email",
            "type": "info"
          }
        }
      },
      {
        "type": "input",
        "group": "code",
        "attributes": {
          "name": "method",
          "type": "submit",
          "value": "code",
          "disabled": false,
          "node_type": "input"
        },
        "messages": [],
        "meta": {
          "label": {
            "id": 1070005,
            "text": "Submit",
            "type": "info"
          }
        }
      },
      {
        "type": "input",
        "group": "default",
        "attributes": {
          "name": "csrf_token",
          "type": "hidden",
          "value": "6NVwYZGMblZmM3nhjEQJdRgTODB6pRdipJJvLcLIxtYdYEJhUQektrns8Qb93qUS/UfgnfD1ZHu7oJn+hfGsZA==",
          "required": true,
          "disabled": false,
          "node_type": "input"
        },
        "messages": [],
        "meta": {}
      }
    ],
    "messages": [
      {
        "id": 4070005,
        "text": "The verification flow expired 8.01 minutes ago, please try again.",
        "type": "error",
        "context": {
          "expired_at": "2023-11-17T13:21:17Z"
        }
      }
    ]
  },
  "state": "choose_method"
}
c
A message from kapa.ai
To request a new verification flow, you need to make a request to the appropriate API endpoint. The endpoint you use depends on the type of application you're working with. For browser applications, use the
/self-service/verification/browser
endpoint. For native applications, use the
/self-service/verification/api
endpoint. Here's an example of how to create a new verification flow for a browser application using cURL:
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>
Replace
{project.slug}
with your project's slug. For a native application, you can use a function like 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() }
Replace
{process.env.ORY_PROJECT_SLUG}
with your project's slug. Remember to handle the response from these requests appropriately in your application. The response will include a new flow ID and other details that you'll need to complete the verification process. For more information, refer to the [Ory documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration).