<@U04UQ68083H> what's the HTTP request I need to s...
# ory-copilot
c
@chilly-king-10285 what's the HTTP request I need to send to sign up with phone number?
b
A message from kapa.ai
To sign up with a phone number using Ory Kratos, you need to send an HTTP POST request to the registration endpoint. Here's the basic structure of the request:
Copy code
curl -X POST -H 'Content-Type: application/json' \     -H 'Accept: application/json' \     -d '{"method":"password","traits.phone":"<phone_number>","password":"<password>"}' \     "https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<your-flow-id|projects.oryapis.com/self-service/registration?flow=<your-flow-id>>"
This request is based on the example provided in the [Ory Kratos documentation for submitting a registration flow](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#submit-registration-flow). However, you need to make a few adjustments: 1. Replace
traits.email
with
traits.phone
and provide the phone number. 2. Ensure your identity schema is configured to use the phone number as an identifier for password-based authentication. To use a phone number for registration, your identity schema should include a configuration similar to this:
Copy code
json {   "properties": {     "traits": {       "type": "object",       "properties": {         "phone": {           "type": "string",           "format": "tel",           "<http://ory.sh/kratos|ory.sh/kratos>": {             "credentials": {               "password": {                 "identifier": true               }             }           }         }       }     }   } }
This configuration is based on the example from the [Ory Kratos documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#phone-number). Remember to replace
<your-project-slug>
with your actual project slug,
<your-flow-id>
with the registration flow ID,
<phone_number>
with the actual phone number, and
<password>
with the desired password. Also, note that depending on your configuration, you might need to include additional fields or follow up with a verification step using an SMS code.
c
@chilly-king-10285 does the default schema have to be phone? What if the default schema is email?
b
A message from kapa.ai
The default schema in Ory Kratos is typically email-based, not phone-based. If you're using the default email schema, you don't need to modify it to use phone numbers. Let me explain the options and how to proceed with either email or phone: 1. Default Email Schema: The default identity schema in Ory Kratos uses email as the primary identifier. This is evident from the [Ory documentation on identity schema](https://www.ory.sh/docs/kratos/manage-identities/identity-schema), which states: "The Ory Network provides three basic identity schema presets. [...] Email and password: With this preset, identities have a single trait, the
email
. The
email
is the login identifier and is used for email verification and for account recovery." If you're using this default schema, your registration request would look like this:
Copy code
curl -X POST -H 'Content-Type: application/json' \        -H 'Accept: application/json' \        -d '{"method":"password","traits":{"email":"<mailto:user@example.com|user@example.com>"},"password":"password123"}' \        "https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<your-flow-id|projects.oryapis.com/self-service/registration?flow=<your-flow-id>>"
2. Custom Schema for Phone: If you want to use phone numbers instead of or in addition to email, you need to customize your identity schema. The [Ory documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#phone-number) provides an example of how to include a phone number in your schema:
Copy code
json    {      "properties": {        "traits": {          "type": "object",          "properties": {            "phone": {              "type": "string",              "format": "tel",              "<http://ory.sh/kratos|ory.sh/kratos>": {                "credentials": {                  "password": {                    "identifier": true                  }                }              }            }          }        }      }    }
With this custom schema, you can then use a phone number for registration:
Copy code
curl -X POST -H 'Content-Type: application/json' \        -H 'Accept: application/json' \        -d '{"method":"password","traits":{"phone":"+1234567890"},"password":"password123"}' \        "https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<your-flow-id|projects.oryapis.com/self-service/registration?flow=<your-flow-id>>"
In summary, the default schema uses email, not phone. If you want to use phone numbers, you need to customize your identity schema. You can use either email or phone (or both) depending on your schema configuration.
c
@chilly-king-10285 and what if I want to this identity to be authenticated using SMS code?
b
A message from kapa.ai
To authenticate an identity using SMS code instead of a password, you need to configure Ory Kratos to use the passwordless one-time code method via SMS. Here's how you can set this up: 1. First, you need to enable the one-time code strategy for passwordless authentication. According to the [Ory documentation on passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp), you can do this by adding the following configuration:
Copy code
yaml
   selfservice:
     methods:
       code:
         passwordless_enabled: true
2. Next, you need to modify your identity schema to support SMS-based authentication. Here's an example of how your schema should look, based on the [Ory documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier):
Copy code
json
   {
     "properties": {
       "traits": {
         "type": "object",
         "properties": {
           "phone": {
             "type": "string",
             "format": "tel",
             "title": "Phone Number",
             "<http://ory.sh/kratos|ory.sh/kratos>": {
               "credentials": {
                 "code": {
                   "identifier": true,
                   "via": "sms"
                 }
               }
             }
           }
         }
       }
     }
   }
3. You also need to configure an SMS channel for sending the one-time codes. This involves setting up an SMS provider as described in the [Ory documentation on sending SMS](https://www.ory.sh/docs/kratos/emails-sms/sending-sms). Once you have these configurations in place, the registration process will involve two steps: 1. The user submits their phone number. 2. Ory sends a one-time code via SMS, which the user then enters to complete the registration. The exact API calls for this process aren't explicitly provided in the knowledge sources, but based on the general Ory API structure, it would likely involve: 1. Initiating a registration flow:
Copy code
GET https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration/api|projects.oryapis.com/self-service/registration/api>
2. Submitting the phone number:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<flow-id|projects.oryapis.com/self-service/registration?flow=<flow-id>>
   Content-Type: application/json

   {
     "method": "code",
     "traits": {
       "phone": "+1234567890"
     }
   }
3. Submitting the received code:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<flow-id|projects.oryapis.com/self-service/registration?flow=<flow-id>>
   Content-Type: application/json

   {
     "method": "code",
     "code": "123456"
   }
Please note that the exact structure of these API calls might vary based on your specific configuration and the latest version of Ory Kratos. You should refer to the most up-to-date API documentation for the precise request format.
To authenticate an identity using SMS code instead of a password, you need to configure Ory Kratos to use the passwordless one-time code method via SMS. Here's how you can set this up: 1. First, you need to enable the one-time code strategy for passwordless authentication. According to the [Ory documentation on passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp), you can do this by adding the following configuration:
Copy code
yaml    selfservice:      methods:        code:          passwordless_enabled: true
2. Next, you need to modify your identity schema to support SMS-based authentication. Here's an example of how your schema should look, based on the [Ory documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier):
Copy code
json    {      "properties": {        "traits": {          "type": "object",          "properties": {            "phone": {              "type": "string",              "format": "tel",              "title": "Phone Number",              "<http://ory.sh/kratos|ory.sh/kratos>": {                "credentials": {                  "code": {                    "identifier": true,                    "via": "sms"                  }                }              }            }          }        }      }    }
3. You also need to configure an SMS channel for sending the one-time codes. This involves setting up an SMS provider as described in the [Ory documentation on sending SMS](https://www.ory.sh/docs/kratos/emails-sms/sending-sms). Once you have these configurations in place, the registration process will involve two steps: 1. The user submits their phone number. 2. Ory sends a one-time code via SMS, which the user then enters to complete the registration. The exact API calls for this process aren't explicitly provided in the knowledge sources, but based on the general Ory API structure, it would likely involve: 1. Initiating a registration flow:
Copy code
GET https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration/api|projects.oryapis.com/self-service/registration/api>
2. Submitting the phone number:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<flow-id|projects.oryapis.com/self-service/registration?flow=<flow-id>>    Content-Type: application/json     {      "method": "code",      "traits": {        "phone": "+1234567890"      }    }
3. Submitting the received code:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<flow-id|projects.oryapis.com/self-service/registration?flow=<flow-id>>    Content-Type: application/json     {      "method": "code",      "code": "123456"    }
Please note that the exact structure of these API calls might vary based on your specific configuration and the latest version of Ory Kratos. You should refer to the most up-to-date API documentation for the precise request format. [Ory Documentation: Passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code) [Ory Documentation: Customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier) [Ory Documentation: Sending SMS](https://www.ory.sh/docs/kratos/emails-sms/sending-sms)
c
@chilly-king-10285 I keep getting the error
additionalProperties \"phone\" not allowed
.
b
A message from kapa.ai
I apologize for the confusion. The error you're encountering suggests that there might be an issue with your configuration. Let's address this based on the information from the knowledge sources. The error "additionalProperties \"phone\" not allowed" typically occurs when you're trying to use a property that isn't defined in your schema or configuration. This could be happening for a couple of reasons: 1. Your identity schema might not be properly configured to include the phone property. 2. Your Ory Kratos configuration might be outdated or incompatible with the version you're using. To resolve this, you should: 1. Ensure your identity schema correctly defines the phone property. Here's an example of how it should look:
Copy code
json    {      "$id": "<https://schemas.ory.sh/presets/kratos/quickstart/phone-password/identity.schema.json>",      "$schema": "<http://json-schema.org/draft-07/schema#>",      "title": "Person",      "type": "object",      "properties": {        "traits": {          "type": "object",          "properties": {            "phone": {              "type": "string",              "title": "Phone number",              "format": "tel",              "<http://ory.sh/kratos|ory.sh/kratos>": {                "credentials": {                  "password": {                    "identifier": true                  }                },                "verification": {                  "via": "sms"                }              }            }          },          "additionalProperties": false        }      }    }
This example is based on the [Ory documentation for phone number verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#phone-number-verification). 2. Check your Ory Kratos configuration. Make sure you've enabled the necessary methods for phone-based authentication. For example:
Copy code
yaml    selfservice:      methods:        code:          enabled: true          passwordless_enabled: true
3. If you're using a custom configuration, ensure that you haven't accidentally disallowed additional properties. In your schema, you should have
"additionalProperties": false
only within the
traits
object, not at the top level of the schema. 4. If you're using Ory Network, make sure you're using the latest version of Ory Kratos. Some configuration options might have changed in recent versions. If you continue to encounter issues, it might be helpful to review your entire configuration and compare it with the examples provided in the Ory documentation. If the problem persists, you may want to reach out to Ory support or post your full configuration (with sensitive information redacted) on the Ory community forums for more specific assistance. [Ory Documentation: Phone number verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#phone-number-verification)
c
@chilly-king-10285 and what's the HTTP request payload to login using phone number and request verification code? I would like the verification code to be returned in the response, not sent using courier.
b
A message from kapa.ai
Based on the information provided in the knowledge sources, I can provide guidance on how to initiate a login flow using a phone number and request a verification code. However, it's important to note that the Ory Kratos system is designed to send verification codes through its courier system (typically via SMS) for security reasons. There isn't a direct way to have the verification code returned in the response instead of being sent through the courier. That being said, here's how you can initiate a login flow using a phone number: 1. First, you need to initiate a login flow:
Copy code
GET https://<your-project-slug>.<http://projects.oryapis.com/self-service/login/api|projects.oryapis.com/self-service/login/api>
2. Then, you can submit the phone number to request a verification code:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/login?flow=<flow-id|projects.oryapis.com/self-service/login?flow=<flow-id>> Content-Type: application/json  {   "method": "code",   "identifier": "+1234567890" }
This request is based on the structure described in the [Ory API Reference for updateLoginFlow](https://www.ory.sh/docs/reference/api#tag/frontend/operation/updateLoginFlow). The
"method": "code"
indicates that you're using the one-time code method, and the
"identifier"
field contains the phone number. After sending this request, Ory Kratos will generate a verification code and send it via SMS to the provided phone number. The system is designed this way to maintain security and prevent unauthorized access to verification codes. If you need the verification code to be returned in the response for testing or development purposes, this isn't a standard feature of Ory Kratos. You might need to consider setting up a custom SMS provider that logs the codes for development environments, but this approach is not recommended for production use due to security concerns. For production use, it's strongly recommended to follow the standard flow where the code is sent via SMS, as this is more secure and aligns with best practices for authentication. [Ory API Reference: updateLoginFlow](https://www.ory.sh/docs/reference/api#tag/frontend/operation/updateLoginFlow)
c
@chilly-king-10285 I tried this and I had
{"error":{"code":500,"status":"Internal Server Error","message":"mail: missing '@' or angle-addr"}}
. Maybe because this identity had email schema when created and was updated after to have phone schema. How can I fix this? And how can I update identity_credential_type to have "code" identity_credential_type id?
b
A message from kapa.ai
Based on the information provided in the knowledge sources and your previous interactions, it seems you're encountering an issue related to schema changes and credential types. Let's address your questions: 1. Regarding the error "mail: missing '@' or angle-addr": This error suggests that the system is still trying to send an email instead of an SMS, which aligns with your observation that the identity was initially created with an email schema and later updated to include a phone schema. To fix this issue, you need to ensure that your identity schema is correctly updated and that the system recognizes the phone number as the primary identifier for the one-time code method. Here's what you can do: a) Update your identity schema to include the phone number as the identifier for the code method:
Copy code
json
{
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "phone": {
          "type": "string",
          "format": "tel",
          "title": "Phone number",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "code": {
                "identifier": true,
                "via": "sms"
              }
            },
            "verification": {
              "via": "sms"
            }
          }
        }
      }
    }
  }
}
b) After updating the schema, you may need to update the existing identities to match the new schema. Unfortunately, the knowledge sources don't provide a direct method for this. You might need to use the Ory Kratos API to update each identity individually. 2. Regarding updating the identity_credential_type to include "code": The identity_credential_type is typically managed internally by Ory Kratos based on your schema and configuration. To enable the "code" credential type, you need to ensure that your Ory Kratos configuration includes the following:
Copy code
yaml
selfservice:
  methods:
    code:
      enabled: true
      passwordless_enabled: true
However, it's important to note that changing schemas and credential types for existing identities can be complex and may lead to inconsistencies. The Ory documentation doesn't provide a straightforward method for updating existing identities' credential types. Given the complexity of your situation, I would recommend the following steps: 1. Ensure your schema and configuration are correctly set up for phone-based authentication as shown above. 2. For existing identities, you might need to create new identities with the correct schema and migrate the data, rather than trying to update the existing ones. 3. If you need to keep the existing identities, you may need to use the Ory Kratos API to update each identity manually. However, this process is not well-documented and could potentially lead to issues.
Based on the information provided in the knowledge sources and your previous interactions, it seems you're encountering an issue related to schema changes and credential types. Let's address your questions: 1. Regarding the error "mail: missing '@' or angle-addr": This error suggests that the system is still trying to send an email instead of an SMS, which aligns with your observation that the identity was initially created with an email schema and later updated to include a phone schema. To fix this issue, you need to ensure that your identity schema is correctly updated and that the system recognizes the phone number as the primary identifier for the one-time code method. Here's what you can do: a) Update your identity schema to include the phone number as the identifier for the code method:
Copy code
json {   "properties": {     "traits": {       "type": "object",       "properties": {         "phone": {           "type": "string",           "format": "tel",           "title": "Phone number",           "<http://ory.sh/kratos|ory.sh/kratos>": {             "credentials": {               "code": {                 "identifier": true,                 "via": "sms"               }             },             "verification": {               "via": "sms"             }           }         }       }     }   } }
b) After updating the schema, you may need to update the existing identities to match the new schema. Unfortunately, the knowledge sources don't provide a direct method for this. You might need to use the Ory Kratos API to update each identity individually. 2. Regarding updating the identity_credential_type to include "code": The identity_credential_type is typically managed internally by Ory Kratos based on your schema and configuration. To enable the "code" credential type, you need to ensure that your Ory Kratos configuration includes the following:
Copy code
yaml selfservice:   methods:     code:       enabled: true       passwordless_enabled: true
However, it's important to note that changing schemas and credential types for existing identities can be complex and may lead to inconsistencies. The Ory documentation doesn't provide a straightforward method for updating existing identities' credential types. Given the complexity of your situation, I would recommend the following steps: 1. Ensure your schema and configuration are correctly set up for phone-based authentication as shown above. 2. For existing identities, you might need to create new identities with the correct schema and migrate the data, rather than trying to update the existing ones. 3. If you need to keep the existing identities, you may need to use the Ory Kratos API to update each identity manually. However, this process is not well-documented and could potentially lead to issues. If these steps don't resolve your issue, you may need to reach out to Ory support directly for more specific guidance on migrating identities from email to phone-based authentication, as this seems to be a complex use case that isn't fully covered in the public documentation. [Ory Documentation: Passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code) [Ory Documentation: Customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier)
c
@chilly-king-10285 now I have this error when I try to update schema from email to phone via PATCH request
"I[#/traits/phone] S[#/properties/traits/properties/phone] credentials.code.via has unknown value \"sms\""
. My request body is something like this:
Copy code
[
  {
    "op": "replace",
    "path": "/schema_id",
    "value": "phone_schema_v0"
  },
  {
    "op": "replace",
    "path": "/traits",
    "value": {
      "phone": "+21234567890"
    }
  },
  {
    "op": "add",
    "path": "/verifiable_addresses",
    "value": [
        {
            "value": "+21234567890",
            "verified": false,
            "via": "sms",
            "status": "pending"
        }
    ]
  }
]
b
A message from kapa.ai
Based on the error message you're receiving and the information available in the knowledge sources, it appears that there's an issue with the schema configuration for the phone number trait. Let's address this problem: The error "credentials.code.via has unknown value \"sms\"" suggests that the schema you're trying to use (
phone_schema_v0
) might not be correctly configured to support SMS-based verification. To resolve this, you need to ensure that your identity schema for
phone_schema_v0
is properly set up to use SMS for the code credential. Here's how the phone trait in your schema should be configured:
Copy code
json {   "properties": {     "traits": {       "type": "object",       "properties": {         "phone": {           "type": "string",           "title": "Phone number",           "format": "tel",           "<http://ory.sh/kratos|ory.sh/kratos>": {             "credentials": {               "code": {                 "identifier": true,                 "via": "sms"               }             },             "verification": {               "via": "sms"             }           }         }       }     }   } }
This configuration is based on the examples provided in the [Ory documentation for phone number verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#phone-number-verification) and [passwordless one-time-code login identifier](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier). Once you've updated your schema configuration, you should be able to use the PATCH request you provided to update the identity. However, note that changing an identity's schema and traits can be a complex operation, and you might need to handle the transition carefully, especially if you're changing from email to phone as the primary identifier. If you continue to encounter issues after updating your schema, you may need to: 1. Verify that the
phone_schema_v0
is correctly defined and uploaded to your Ory Kratos instance. 2. Ensure that your Ory Kratos configuration has SMS verification enabled. 3. Consider creating a new identity with the correct schema instead of updating an existing one, as changing core identity attributes can sometimes lead to unexpected issues. If the problem persists after these steps, you might need to reach out to Ory support for more specific assistance, as there might be additional configuration or compatibility issues that are not covered in the public documentation. [Ory Documentation: Phone number verification](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#phone-number-verification) [Ory Documentation: Passwordless one-time-code login identifier](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier)
c
@chilly-king-10285 I no longer have the error when updating schema, but when I update with PATCH request, I get this as a part of the response:
Copy code
"credentials": {
        "password": {
            "type": "password",
            "identifiers": [
                "<mailto:test@test.com|test@test.com>"
            ],
            "version": 0,
            ...
        }
    },
which I don't think is not phone schema compliant.
b
A message from kapa.ai
Based on the response you're receiving after the PATCH request, it appears that the identity's credentials are not fully updated to reflect the phone schema. This situation suggests that while the schema update was accepted, the existing credentials weren't automatically adjusted to match the new schema. Let's address this issue: 1. The presence of the email address in the
identifiers
field under the
password
credential type indicates that the identity still retains its original email-based authentication method. 2. This behavior is consistent with Ory's approach to maintaining backwards compatibility and data integrity. Changing an identity's fundamental authentication method (from email to phone in this case) is not automatically handled by simply updating the schema. To fully transition this identity to a phone-based authentication system, you may need to take additional steps: 1. Remove the existing password credential: You can use the Admin API to delete the existing password credential. However, the exact endpoint for this operation is not provided in the given knowledge sources. 2. Add a new code-based credential for the phone number: After removing the password credential, you should add a new credential of type "code" for the phone number. Again, the specific API call for this is not detailed in the provided knowledge sources. 3. Update the verifiable addresses: Ensure that the phone number is added as a verifiable address and the email address is removed (if it's no longer needed). Here's an example of how your PATCH request might look to update the verifiable addresses:
Copy code
json
[
  {
    "op": "replace",
    "path": "/verifiable_addresses",
    "value": [
      {
        "value": "+21234567890",
        "verified": false,
        "via": "sms",
        "status": "pending"
      }
    ]
  }
]
It's important to note that these operations are sensitive and can potentially lock users out of their accounts if not done correctly. The Ory documentation doesn't provide explicit guidance on this kind of transition, which suggests it's not a common or recommended operation. Given the complexity and potential risks involved in this transition, I would strongly recommend: 1. Testing this process thoroughly in a non-production environment. 2. Considering creating new identities with the desired schema instead of updating existing ones. 3. Reaching out to Ory support for guidance on the best way to handle this transition, as it involves changing core authentication methods for existing identities. If you must proceed with updating existing identities, you may need to use a combination of API calls to remove old credentials, add new ones, and update verifiable addresses. However, the exact sequence and API endpoints for these operations are not clearly documented in the provided knowledge sources. [Ory Documentation: Customize identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema)
Based on the response you're receiving after the PATCH request, it appears that the identity's credentials are not fully updated to reflect the phone schema. This situation suggests that while the schema update was accepted, the existing credentials weren't automatically adjusted to match the new schema. Let's address this issue: 1. The presence of the email address in the
identifiers
field under the
password
credential type indicates that the identity still retains its original email-based authentication method. 2. This behavior is consistent with Ory's approach to maintaining backwards compatibility and data integrity. Changing an identity's fundamental authentication method (from email to phone in this case) is not automatically handled by simply updating the schema. To fully transition this identity to a phone-based authentication system, you may need to take additional steps: 1. Remove the existing password credential: You can use the Admin API to delete the existing password credential. However, the exact endpoint for this operation is not provided in the given knowledge sources. 2. Add a new code-based credential for the phone number: After removing the password credential, you should add a new credential of type "code" for the phone number. Again, the specific API call for this is not detailed in the provided knowledge sources. 3. Update the verifiable addresses: Ensure that the phone number is added as a verifiable address and the email address is removed (if it's no longer needed). Here's an example of how your PATCH request might look to update the verifiable addresses:
Copy code
json [   {     "op": "replace",     "path": "/verifiable_addresses",     "value": [       {         "value": "+21234567890",         "verified": false,         "via": "sms",         "status": "pending"       }     ]   } ]
It's important to note that these operations are sensitive and can potentially lock users out of their accounts if not done correctly. The Ory documentation doesn't provide explicit guidance on this kind of transition, which suggests it's not a common or recommended operation. Given the complexity and potential risks involved in this transition, I would strongly recommend: 1. Testing this process thoroughly in a non-production environment. 2. Considering creating new identities with the desired schema instead of updating existing ones. 3. Reaching out to Ory support for guidance on the best way to handle this transition, as it involves changing core authentication methods for existing identities. If you must proceed with updating existing identities, you may need to use a combination of API calls to remove old credentials, add new ones, and update verifiable addresses. However, the exact sequence and API endpoints for these operations are not clearly documented in the provided knowledge sources. [Ory Documentation: Customize identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema) Remember, changing authentication methods for existing users is a sensitive operation that can have security implications. Always prioritize the security and accessibility of user accounts when making such changes.
c
@chilly-king-10285 the following config keeps causing the error `"I[#/traits/phone] S[#/properties/traits/properties/phone] credentials.code.via has unknown value \"sms\""`:
Copy code
{
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "phone": {
          "type": "string",
          "title": "Phone number",
          "format": "tel",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "code": {
                "identifier": true,
                "via": "sms"
              }
            },
            "verification": {
              "via": "sms"
            }
          }
        }
      }
    }
  }
}
What are the available values options for
via
key inside
code
credential?
b
A message from kapa.ai
Based on the information provided in the knowledge sources, I can help clarify the available options for the
via
key inside the
code
credential. The error you're encountering suggests that there might be an issue with the schema configuration. Let's look at the correct configuration for the
via
key in the
code
credential: According to the [Ory documentation on passwordless one-time-code login identifier](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier), the available options for the
via
key inside the
code
credential are: 1. "email" 2. "sms" Here's an example of the correct configuration for each: For email:
Copy code
json {   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "email"       }     }   } }
For SMS:
Copy code
json {   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "sms"       }     }   } }
The error you're seeing might be due to a formatting issue in your JSON. I notice that in your configuration, the
<http://ory.sh/kratos|ory.sh/kratos>
key is formatted as a URL (
<http://ory.sh/kratos|ory.sh/kratos>
). This is incorrect and likely the cause of your error. The correct format should be:
Copy code
json {   "properties": {     "traits": {       "type": "object",       "properties": {         "phone": {           "type": "string",           "title": "Phone number",           "format": "tel",           "<http://ory.sh/kratos|ory.sh/kratos>": {             "credentials": {               "code": {                 "identifier": true,                 "via": "sms"               }             },             "verification": {               "via": "sms"             }           }         }       }     }   } }
Make sure to use
"<http://ory.sh/kratos|ory.sh/kratos>"
as a plain string key, not a URL. This should resolve the error you're encountering. [Ory Documentation: Passwordless one-time-code login identifier](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier)
c
@chilly-king-10285 let's try again. What are all the configurations required to enable loging with phone number and using code sent via SMS? And if it's possible to just return the code in an HTTP response without sending it, how can I configure this as well? And what are the HTTP requests for registering, loging in, and recovery in both cases?
b
A message from kapa.ai
To enable logging in with a phone number using a code sent via SMS, you need to configure several components in Ory Kratos. Here's a comprehensive guide based on the information from the Ory documentation: 1. Enable passwordless login with one-time code: In your Ory Kratos configuration file, add:
Copy code
yaml
   selfservice:
     methods:
       code:
         enabled: true
         passwordless_enabled: true
[Ory Documentation: Passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp) 2. Configure the identity schema: Update your identity schema to include phone number as an identifier for the code method:
Copy code
json
   {
     "properties": {
       "traits": {
         "type": "object",
         "properties": {
           "phone": {
             "type": "string",
             "format": "tel",
             "title": "Phone Number",
             "<http://ory.sh/kratos|ory.sh/kratos>": {
               "credentials": {
                 "code": {
                   "identifier": true,
                   "via": "sms"
                 }
               },
               "verification": {
                 "via": "sms"
               }
             }
           }
         }
       }
     }
   }
[Ory Documentation: Customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier) 3. Configure SMS delivery: Set up an SMS channel in your Ory configuration:
Copy code
yaml
   courier:
     channels:
       - id: sms
         type: http
         request_config:
           url: <https://api.your-sms-provider.com/send>
           method: POST
           body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgVG86IGN0eC5yZWNpcGllbnQsCiAgQm9keTogY3R4LmJvZHksCn0>=
           headers:
             Content-Type: application/json
           auth:
             type: basic_auth
             config:
               user: your_username
               password: your_password
[Ory Documentation: Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) Regarding returning the code in an HTTP response without sending it via SMS, this is not a standard feature of Ory Kratos due to security concerns. Ory Kratos is designed to send verification codes through secure channels like SMS or email to maintain the integrity of the authentication process. Now, let's look at the HTTP requests for registration, login, and recovery: 1. Registration:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<flow-id|projects.oryapis.com/self-service/registration?flow=<flow-id>>
   Content-Type: application/json

   {
     "method": "code",
     "traits": {
       "phone": "+1234567890"
     }
   }
2. Login:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/login?flow=<flow-id|projects.oryapis.com/self-service/login?flow=<flow-id>>
   Content-Type: application/json

   {
     "method": "code",
     "identifier": "+1234567890"
   }
To enable logging in with a phone number using a code sent via SMS, you need to configure several components in Ory Kratos. Here's a comprehensive guide based on the information from the Ory documentation: 1. Enable passwordless login with one-time code: In your Ory Kratos configuration file, add:
Copy code
yaml    selfservice:      methods:        code:          enabled: true          passwordless_enabled: true
[Ory Documentation: Passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp) 2. Configure the identity schema: Update your identity schema to include phone number as an identifier for the code method:
Copy code
json    {      "properties": {        "traits": {          "type": "object",          "properties": {            "phone": {              "type": "string",              "format": "tel",              "title": "Phone Number",              "<http://ory.sh/kratos|ory.sh/kratos>": {                "credentials": {                  "code": {                    "identifier": true,                    "via": "sms"                  }                },                "verification": {                  "via": "sms"                }              }            }          }        }      }    }
[Ory Documentation: Customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#passwordless-one-time-code-login-identifier) 3. Configure SMS delivery: Set up an SMS channel in your Ory configuration:
Copy code
yaml    courier:      channels:        - id: sms          type: http          request_config:            url: <https://api.your-sms-provider.com/send>            method: POST            body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgVG86IGN0eC5yZWNpcGllbnQsCiAgQm9keTogY3R4LmJvZHksCn0>=            headers:              Content-Type: application/json            auth:              type: basic_auth              config:                user: your_username                password: your_password
[Ory Documentation: Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) Regarding returning the code in an HTTP response without sending it via SMS, this is not a standard feature of Ory Kratos due to security concerns. Ory Kratos is designed to send verification codes through secure channels like SMS or email to maintain the integrity of the authentication process. Now, let's look at the HTTP requests for registration, login, and recovery: 1. Registration:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/registration?flow=<flow-id|projects.oryapis.com/self-service/registration?flow=<flow-id>>    Content-Type: application/json     {      "method": "code",      "traits": {        "phone": "+1234567890"      }    }
2. Login:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/login?flow=<flow-id|projects.oryapis.com/self-service/login?flow=<flow-id>>    Content-Type: application/json     {      "method": "code",      "identifier": "+1234567890"    }
3. Recovery:
Copy code
POST https://<your-project-slug>.<http://projects.oryapis.com/self-service/recovery?flow=<flow-id|projects.oryapis.com/self-service/recovery?flow=<flow-id>>    Content-Type: application/json     {      "method": "code",      "identifier": "+1234567890"    }
After each of these requests, Ory Kratos will send an SMS with a verification code to the provided phone number. The user then needs to submit this code in a subsequent request to complete the process. [Ory Documentation: Passwordless one-time-code authentication](https://www.ory.sh/docs/kratos/passwordless/one-time-code) Remember, these are general structures and might need to be adjusted based on your specific Ory Kratos configuration and version. Always refer to the most recent Ory documentation for the most up-to-date information.
c
@chilly-king-10285 what if I need to send the SMS throw a custom made notifications service? It needs request body to be something like this:
Copy code
{
  "channel": "sms",
  "priority": 1,
  "recipient_list": "01012345678",
  "template_id": "0267c1df-62e5-4c79-9ae1-326e69737e75",
  "template_parameters": {
    "code": "generated_code"
  }
}
b
A message from kapa.ai
To send SMS through a custom-made notifications service with the specific request body format you've described, you'll need to configure Ory Kratos to use an HTTP-based SMS delivery option. Here's how you can set this up: 1. First, you need to configure the SMS channel in your Ory Kratos configuration. You can do this using the Ory CLI or by directly editing the configuration file. Here's an example of how to set it up:
Copy code
yaml
courier:
  channels:
    - id: sms
      type: http
      request_config:
        url: <https://your-custom-notification-service.com/send-sms>
        method: POST
        body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgImNoYW5uZWwiOiAic21zIiwKICAicHJpb3JpdHkiOiAxLAogICJyZWNpcGllbnRfbGlzdCI6IGN0eC5yZWNpcGllbnQsCiAgInRlbXBsYXRlX2lkIjogIjAyNjdjMWRmLTYyZTUtNGM3OS05YWUxLTMyNmU2OTczN2U3NSIsCiAgInRlbXBsYXRlX3BhcmFtZXRlcnMiOiB7CiAgICAiY29kZSI6IGN0eC50ZW1wbGF0ZV9kYXRhLlZlcmlmaWNhdGlvbkNvZGUKICB9Cn0>=
        headers:
          Content-Type: application/json
        auth:
          type: api_key
          config:
            name: Authorization
            value: Bearer your-api-key
            in: header
The
body
field contains a Base64-encoded Jsonnet template. When decoded, it looks like this:
Copy code
jsonnet
function(ctx) {
  "channel": "sms",
  "priority": 1,
  "recipient_list": ctx.recipient,
  "template_id": "0267c1df-62e5-4c79-9ae1-326e69737e75",
  "template_parameters": {
    "code": ctx.template_data.VerificationCode
  }
}
This template will generate the JSON payload in the format you specified, using the recipient's phone number and the generated verification code. 2. You'll also need to ensure that your identity schema is configured to use SMS for verification and authentication. Here's an example of how your schema should look:
Copy code
json
{
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "phone": {
          "type": "string",
          "format": "tel",
          "title": "Phone Number",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "code": {
                "identifier": true,
                "via": "sms"
              }
            },
            "verification": {
              "via": "sms"
            }
          }
        }
      }
    }
  }
}
3. Make sure you've enabled the code method in your Ory Kratos configuration:
Copy code
yaml
selfservice:
  methods:
    code:
      enabled: true
      passwordless_enabled: true
With these configurations in place, when Ory Kratos needs to send an SMS, it will make a POST request to your custom notification service with the payload formatted as you specified. Remember to replace
<https://your-custom-notification-service.com/send-sms>
with the actual URL of your notification service, and
your-api-key
with the appropriate API key for authentication. [Ory Documentation: Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms)
To send SMS through a custom-made notifications service with the specific request body format you've described, you'll need to configure Ory Kratos to use an HTTP-based SMS delivery option. Here's how you can set this up: 1. First, you need to configure the SMS channel in your Ory Kratos configuration. You can do this using the Ory CLI or by directly editing the configuration file. Here's an example of how to set it up:
Copy code
yaml courier:   channels:     - id: sms       type: http       request_config:         url: <https://your-custom-notification-service.com/send-sms>         method: POST         body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgImNoYW5uZWwiOiAic21zIiwKICAicHJpb3JpdHkiOiAxLAogICJyZWNpcGllbnRfbGlzdCI6IGN0eC5yZWNpcGllbnQsCiAgInRlbXBsYXRlX2lkIjogIjAyNjdjMWRmLTYyZTUtNGM3OS05YWUxLTMyNmU2OTczN2U3NSIsCiAgInRlbXBsYXRlX3BhcmFtZXRlcnMiOiB7CiAgICAiY29kZSI6IGN0eC50ZW1wbGF0ZV9kYXRhLlZlcmlmaWNhdGlvbkNvZGUKICB9Cn0>=         headers:           Content-Type: application/json         auth:           type: api_key           config:             name: Authorization             value: Bearer your-api-key             in: header
The
body
field contains a Base64-encoded Jsonnet template. When decoded, it looks like this:
Copy code
jsonnet function(ctx) {   "channel": "sms",   "priority": 1,   "recipient_list": ctx.recipient,   "template_id": "0267c1df-62e5-4c79-9ae1-326e69737e75",   "template_parameters": {     "code": ctx.template_data.VerificationCode   } }
This template will generate the JSON payload in the format you specified, using the recipient's phone number and the generated verification code. 2. You'll also need to ensure that your identity schema is configured to use SMS for verification and authentication. Here's an example of how your schema should look:
Copy code
json {   "properties": {     "traits": {       "type": "object",       "properties": {         "phone": {           "type": "string",           "format": "tel",           "title": "Phone Number",           "<http://ory.sh/kratos|ory.sh/kratos>": {             "credentials": {               "code": {                 "identifier": true,                 "via": "sms"               }             },             "verification": {               "via": "sms"             }           }         }       }     }   } }
3. Make sure you've enabled the code method in your Ory Kratos configuration:
Copy code
yaml selfservice:   methods:     code:       enabled: true       passwordless_enabled: true
With these configurations in place, when Ory Kratos needs to send an SMS, it will make a POST request to your custom notification service with the payload formatted as you specified. Remember to replace
<https://your-custom-notification-service.com/send-sms>
with the actual URL of your notification service, and
your-api-key
with the appropriate API key for authentication. [Ory Documentation: Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) Please note that this setup assumes your custom notification service can handle the template ID and parameters as specified. If you need to make any adjustments to the payload format, you can modify the Jsonnet template in the
body
field of the courier configuration.
c
@chilly-king-10285 due
invalid parameter
errors I'm getting when I try your courier configuration, I updated it to the following:
Copy code
yaml
courier:
  channels:
    sms:
      request_config:
        url: <https://your-custom-notification-service.com/send-sms>
        method: POST
        body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgImNoYW5uZWwiOiAic21zIiwKICAicHJpb3JpdHk>iOiAxLAogICJyZWNpcGllbnRfbGlzdCI6IGN0eC5yZWNpcGllbnQsCiAgInRlbXBsYXRlX2lkIjogIjAyNjdjMWRmLTYyZTUtNGM3OS05YWUxLTMyNmU2OTczN2U3NSIsCiAgInRlbXBsYXRlX3BhcmFtZXRlcnMiOiB7CiAgICAiY29kZSI6IGN0eC50ZW1wbGF0ZV9kYXRhLlZlcmlmaWNhdGlvbkNvZGUKICB9Cn0=
        headers:
          Content-Type: application/json
        auth:
          type: api_key
          config:
            name: Authorization
            value: Bearer your-api-key
            in: header
I updated the
- id: smd
and removed
type: HTTP
line as Kratos fails to start without this change. But I'm getting this error when I send registration request:
Copy code
{
  "error": {
    "code": 500,
    "status": "Internal Server Error",
    "reason": "Expected sms template but got <nil>",
    "message": "An internal server error occurred, please contact the system administrator"
  }
}
b
A message from kapa.ai
Thank you for providing the updated configuration and the error message you're encountering. It seems that there are a couple of issues we need to address. Let's go through them step by step: 1. Configuration Update: Your updated configuration looks better, but there are still a few adjustments we need to make:
Copy code
yaml
courier:
  channels:
    - type: sms
      config:
        url: <https://your-custom-notification-service.com/send-sms>
        method: POST
        body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgImNoYW5uZWwiOiAic21zIiwKICAicHJpb3JpdHkiOiAxLAogICJyZWNpcGllbnRfbGlzdCI6IGN0eC5yZWNpcGllbnQsCiAgInRlbXBsYXRlX2lkIjogIjAyNjdjMWRmLTYyZTUtNGM3OS05YWUxLTMyNmU2OTczN2U3NSIsCiAgInRlbXBsYXRlX3BhcmFtZXRlcnMiOiB7CiAgICAiY29kZSI6IGN0eC50ZW1wbGF0ZV9kYXRhLlZlcmlmaWNhdGlvbkNvZGUKICB9Cn0>=
        headers:
          Content-Type: application/json
        auth:
          type: api_key
          config:
            name: Authorization
            value: Bearer your-api-key
            in: header
The main changes are: - We've added back the
type: sms
(not
http
as previously suggested). - We've changed
request_config
to just
config
. - We've removed the angle brackets (
<>
) around the URL and base64 string. 2. Error Message: The error message "Expected sms template but got <nil>" suggests that Ory Kratos is unable to find the SMS template it needs to send the message. This could be because we haven't configured the SMS templates yet. To resolve this, we need to add SMS templates to your configuration. Here's how you can do it:
Copy code
yaml
courier:
  templates:
    verification_code:
      valid:
        sms:
          body:
            plaintext: <base64://WW91ciB2ZXJpZmljYXRpb24gY29kZSBpczoge3sgLlZlcmlmaWNhdGlvbkNvZGUgfX0>=
    login_code:
      valid:
        sms:
          body:
            plaintext: <base64://WW91ciBsb2dpbiBjb2RlIGlzOiB7eyAuTG9naW5Db2RlIH19>
This configuration sets up templates for verification and login codes. The base64-encoded strings decode to: - Verification: "Your verification code is: {{ .VerificationCode }}" - Login: "Your login code is: {{ .LoginCode }}" You can customize these messages as needed, but make sure to encode them in base64. 3. Additional Configuration: Make sure you have also configured the following in your Ory Kratos configuration:
Copy code
yaml
selfservice:
  methods:
    code:
      enabled: true
      passwordless_enabled: true
This enables the code-based authentication method. After making these changes, try restarting Ory Kratos and attempt the registration process again. If you're still encountering issues, please provide any new error messages you receive. [Ory Documentation: Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) [Ory Documentation: Email templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates)
Thank you for providing the updated configuration and the error message you're encountering. It seems that there are a couple of issues we need to address. Let's go through them step by step: 1. Configuration Update: Your updated configuration looks better, but there are still a few adjustments we need to make:
Copy code
yaml courier:   channels:     - type: sms       config:         url: <https://your-custom-notification-service.com/send-sms>         method: POST         body: <base64://ZnVuY3Rpb24oY3R4KSB7CiAgImNoYW5uZWwiOiAic21zIiwKICAicHJpb3JpdHkiOiAxLAogICJyZWNpcGllbnRfbGlzdCI6IGN0eC5yZWNpcGllbnQsCiAgInRlbXBsYXRlX2lkIjogIjAyNjdjMWRmLTYyZTUtNGM3OS05YWUxLTMyNmU2OTczN2U3NSIsCiAgInRlbXBsYXRlX3BhcmFtZXRlcnMiOiB7CiAgICAiY29kZSI6IGN0eC50ZW1wbGF0ZV9kYXRhLlZlcmlmaWNhdGlvbkNvZGUKICB9Cn0>=         headers:           Content-Type: application/json         auth:           type: api_key           config:             name: Authorization             value: Bearer your-api-key             in: header
The main changes are: - We've added back the
type: sms
(not
http
as previously suggested). - We've changed
request_config
to just
config
. - We've removed the angle brackets (
<>
) around the URL and base64 string. 2. Error Message: The error message "Expected sms template but got <nil>" suggests that Ory Kratos is unable to find the SMS template it needs to send the message. This could be because we haven't configured the SMS templates yet. To resolve this, we need to add SMS templates to your configuration. Here's how you can do it:
Copy code
yaml courier:   templates:     verification_code:       valid:         sms:           body:             plaintext: <base64://WW91ciB2ZXJpZmljYXRpb24gY29kZSBpczoge3sgLlZlcmlmaWNhdGlvbkNvZGUgfX0>=     login_code:       valid:         sms:           body:             plaintext: <base64://WW91ciBsb2dpbiBjb2RlIGlzOiB7eyAuTG9naW5Db2RlIH19>
This configuration sets up templates for verification and login codes. The base64-encoded strings decode to: - Verification: "Your verification code is: {{ .VerificationCode }}" - Login: "Your login code is: {{ .LoginCode }}" You can customize these messages as needed, but make sure to encode them in base64. 3. Additional Configuration: Make sure you have also configured the following in your Ory Kratos configuration:
Copy code
yaml selfservice:   methods:     code:       enabled: true       passwordless_enabled: true
This enables the code-based authentication method. After making these changes, try restarting Ory Kratos and attempt the registration process again. If you're still encountering issues, please provide any new error messages you receive. [Ory Documentation: Send SMS to your users](https://www.ory.sh/docs/kratos/emails-sms/sending-sms) [Ory Documentation: Email templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates) Remember, when working with SMS in Ory Kratos, it's important to have both the channel configuration (which defines how to send the SMS) and the templates (which define the content of the SMS) properly set up.
c
@chilly-king-10285 here's the trace of the error I'm getting after adding templates:
Copy code
{"audience":"audit","error":{"debug":"","message":"An internal server error occurred, please contact the system administrator","reason":"Expected sms template but got <nil>","stack_trace":"\<http://ngithub.com/ory/kratos/selfservice/strategy/code.(*Strategy).registrationSendEmail|ngithub.com/ory/kratos/selfservice/strategy/code.(*Strategy).registrationSendEmail>\n\t/project/selfservice/strategy/code/strategy_registration.go:196\ngithub.com/ory/kratos/selfservice/strategy/code.(*Strategy).Register\n\t/project/selfservice/strategy/code/strategy_registration.go:156\ngithub.com/ory/kratos/selfservice/flow/registration.(*Handler).updateRegistrationFlow\n\t/project/selfservice/flow/registration/handler.go:648\ngithub.com/ory/kratos/selfservice/flow/registration.(*Handler).RegisterPublicRoutes.(*Handler).IsNotAuthenticated.func3\n\t/project/session/handler.go:928\ngithub.com/ory/kratos/x.(*RouterPublic).POST.NoCacheHandle.func1\n\t/project/x/nocache.go:21\ngithub.com/ory/kratos/x.(*RouterPublic).Handle.NoCacheHandle.func1\n\t/project/x/nocache.go:21\ngithub.com/julienschmidt/httprouter.(*Router).ServeHTTP\n\t/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387\ngithub.com/ory/nosurf.(*CSRFHandler).handleSuccess\n\t/go/pkg/mod/github.com/ory/nosurf@v1.2.7/handler.go:234\ngithub.com/ory/nosurf.(*CSRFHandler).ServeHTTP\n\t/go/pkg/mod/github.com/ory/nosurf@v1.2.7/handler.go:185\ngithub.com/ory/kratos/cmd/daemon.servePublic.MaxBytesHandler.func4\n\t/usr/local/go/src/net/http/server.go:3906\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/urfave/negroni.(*Negroni).UseHandler.Wrap.func1\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/kratos/x.init.func1\n\t/project/x/clean_url.go:15\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/rs/cors.(*Cors).ServeHTTP\n\t/go/pkg/mod/github.com/rs/cors@v1.11.0/cors.go:324\ngithub.com/ory/kratos/cmd/daemon.servePublic.func1\n\t/project/cmd/daemon/serve.go:114\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:284\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:142\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:92\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:104\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:234\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220","status":"Internal Server Error","status_code":500},"http_request":{"headers":{"accept":"application/json","accept-encoding":"gzip","content-length":"55","content-type":"application/json","user-agent":"curl/7.81.0"},"host":"localhost:4455","method":"POST","path":"/self-service/registration","query":"flow=23b8e262-ff0a-4b55-8ae4-b11e67b6e99b","remote":"172.18.0.9:40890","scheme":"http"},"level":"info","msg":"Encountered self-service flow error.","registration_flow":{"Type":"api","active":"","id":"23b8e262-ff0a-4b55-8ae4-b11e67b6e99b","nid":"5944a518-c6b5-4288-a4e5-495a14a32274","request_url":"<http://localhost:4455/self-service/registration/api>","return_to":"","state":"choose_method"},"service_name":"Ory Kratos","service_version":"v1.3.1","time":"2024-12-26T10:33:10.672883219Z"}
kratos  | {"audience":"application","error":{"debug":"","message":"An internal server error occurred, please contact the system administrator","reason":"Expected sms template but got <nil>","stack_trace":"\<http://ngithub.com/ory/kratos/selfservice/strategy/code.(*Strategy).registrationSendEmail|ngithub.com/ory/kratos/selfservice/strategy/code.(*Strategy).registrationSendEmail>\n\t/project/selfservice/strategy/code/strategy_registration.go:196\ngithub.com/ory/kratos/selfservice/strategy/code.(*Strategy).Register\n\t/project/selfservice/strategy/code/strategy_registration.go:156\ngithub.com/ory/kratos/selfservice/flow/registration.(*Handler).updateRegistrationFlow\n\t/project/selfservice/flow/registration/handler.go:648\ngithub.com/ory/kratos/selfservice/flow/registration.(*Handler).RegisterPublicRoutes.(*Handler).IsNotAuthenticated.func3\n\t/project/session/handler.go:928\ngithub.com/ory/kratos/x.(*RouterPublic).POST.NoCacheHandle.func1\n\t/project/x/nocache.go:21\ngithub.com/ory/kratos/x.(*RouterPublic).Handle.NoCacheHandle.func1\n\t/project/x/nocache.go:21\ngithub.com/julienschmidt/httprouter.(*Router).ServeHTTP\n\t/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387\ngithub.com/ory/nosurf.(*CSRFHandler).handleSuccess\n\t/go/pkg/mod/github.com/ory/nosurf@v1.2.7/handler.go:234\ngithub.com/ory/nosurf.(*CSRFHandler).ServeHTTP\n\t/go/pkg/mod/github.com/ory/nosurf@v1.2.7/handler.go:185\ngithub.com/ory/kratos/cmd/daemon.servePublic.MaxBytesHandler.func4\n\t/usr/local/go/src/net/http/server.go:3906\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/urfave/negroni.(*Negroni).UseHandler.Wrap.func1\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:46\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/ory/kratos/x.init.func1\n\t/project/x/clean_url.go:15\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\ngithub.com/rs/cors.(*Cors).ServeHTTP\n\t/go/pkg/mod/github.com/rs/cors@v1.11.0/cors.go:324\ngithub.com/ory/kratos/cmd/daemon.servePublic.func1\n\t/project/cmd/daemon/serve.go:114\ngithub.com/urfave/negroni.HandlerFunc.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:29\ngithub.com/urfave/negroni.middleware.ServeHTTP\n\t/go/pkg/mod/github.com/urfave/negroni@v1.0.0/negroni.go:38\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:284\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:142\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:92\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:104\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerRequestSize.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.13.0/prometheus/promhttp/instrument_server.go:234\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2220","status":"Internal Server Error","status_code":500},"http_request":{"headers":{"accept":"application/json","accept-encoding":"gzip","content-length":"55","content-type":"application/json","user-agent":"curl/7.81.0"},"host":"localhost:4455","method":"POST","path":"/self-service/registration","query":"flow=23b8e262-ff0a-4b55-8ae4-b11e67b6e99b","remote":"172.18.0.9:40890","scheme":"http"},"http_response":{"status_code":500},"level":"error","msg":"An error occurred while handling a request","service_name":"Ory Kratos","service_version":"v1.3.1","time":"2024-12-26T10:33:10.672984738Z"}
b
A message from kapa.ai
Sorry @clean-piano-39737, I seem to be having a bit of trouble. Don't worry though, I've pinged my support folks and they will try to fix me up! 🧑‍💻 Perhaps try again in 5mins?