<@U04UQ68083H> Hi all, I am setting SMS OTP ``` ...
# ory-copilot
s
@chilly-king-10285 Hi all, I am setting SMS OTP
Copy code
"phone": {
          "type": "string",
          "format": "tel",
          "title": "Phone number",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "code": {
                "identifier": true,
                "via": "sms"
              }
            }
          }
        }
and
Copy code
courier:
  channels:
    - id: sms
      type: http
      request_config:
........
but i get error when call
self-service/registration?flow=90ef0a1a-6084-42bd-9432-811cddf4d00e
with phone: "+84....."
Copy code
"messages": [
          {
            "id": 4000001,
            "text": "credentials.code.via has unknown value \"sms\"",
            "type": "error",
            "context": {
              "reason": "credentials.code.via has unknown value \"sms\""
            }
          }
        ],
help me fix
b
A message from kapa.ai
The error message
"credentials.code.via has unknown value \"sms\""
indicates that Ory Kratos does not recognize
"sms"
as a valid value for the
via
field in your identity schema under
credentials.code
. However, according to the official Ory documentation and schema examples,
"sms"
is indeed the correct value for enabling SMS OTP for a phone number. Here’s a correct example from the docs:
Copy code
json "phone": {   "type": "string",   "format": "tel",   "title": "Phone number",   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "sms"       }     }   } }
[Phone number and password schema example](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#phone-number-and-password) Possible reasons for your error: 1. Schema Key Typo: In your schema, you wrote:
Copy code
"<http://ory.sh/kratos|ory.sh/kratos>":
It should be:
Copy code
"<http://ory.sh/kratos|ory.sh/kratos>":
The key must be exactly
"<http://ory.sh/kratos|ory.sh/kratos>"
(without angle brackets or pipes). 2. Ory Kratos Version: If you are using an older version of Ory Kratos, the
"sms"
value for
via
may not be supported. Make sure you are running a recent version that supports SMS OTP. 3. Configuration: Ensure that you have enabled the passwordless code strategy and configured the SMS channel correctly in your Ory configuration. See the docs for [enabling SMS OTP](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp). How to fix: - Update your schema to use the correct key:
Copy code
json   "phone": {     "type": "string",     "format": "tel",     "title": "Phone number",     "<http://ory.sh/kratos|ory.sh/kratos>": {       "credentials": {         "code": {           "identifier": true,           "via": "sms"         }       }     }   }
- Make sure your Ory Kratos version supports SMS OTP. - Double-check your configuration for the SMS channel. References: - [Customize identity schema: Phone number and password](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#phone-number-and-password) - [Enable SMS one-time-code (OTP)](https://www.ory.sh/docs/kratos/passwordless/one-time-code#enable-sms-one-time-code-otp) If you correct the schema key and still see the error, please check your Ory Kratos version and configuration. If the problem persists, let us know your Kratos version and any relevant configuration details.