<@U04UQ68083H> is ory kratos only can send login c...
# ory-copilot
b
@chilly-king-10285 is ory kratos only can send login code using identifier username, email , phone?
b
A message from kapa.ai
Ory Kratos can send login codes (for passwordless or multi-factor authentication) using identifiers such as email and phone number. The documentation and schema examples show that the one-time code (OTP) strategy is configured with either email or phone number as the identifier, using the code credential with "via": "email" or "via": "sms" options. There is no mention in the knowledge sources of sending login codes using a username as the identifier—only email and phone are supported for code-based login flows. For example, a custom identity schema for code-based login would look like:
Copy code
json "email": {   "type": "string",   "format": "email",   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "email"       }     }   } }, "phone_number": {   "type": "string",   "format": "tel",   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "sms"       }     }   } }
[Custom identity schema for one-time code](https://www.ory.sh/docs/kratos/passwordless/one-time-code#custom-identity-schema) Therefore, Ory Kratos supports sending login codes using email and phone number as identifiers, but not username. If you need to use usernames, you would need to use the password strategy instead, not the code/OTP strategy.
b
is the a way to send login code using identifier custom identity field like using customerId? @chilly-king-10285
b
A message from kapa.ai
Based on the available knowledge sources, Ory Kratos supports sending login codes using fields that are marked as identifiers for the code strategy in your identity schema. The official documentation and examples specifically show email and phone number as supported fields for sending one-time codes (via "email" or "sms"):
Copy code
json "email": {   "type": "string",   "format": "email",   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "email"       }     }   } }, "phone_number": {   "type": "string",   "format": "tel",   "<http://ory.sh/kratos|ory.sh/kratos>": {     "credentials": {       "code": {         "identifier": true,         "via": "sms"       }     }   } }
[Custom identity schema for one-time code](https://www.ory.sh/docs/kratos/passwordless/one-time-code#custom-identity-schema) The documentation does not mention support for sending login codes using a custom identity field such as customerId. The "via" property is only shown with "email" and "sms" as valid options. There is no information about using other channels or custom fields for code delivery. In summary: I'm sorry, but the knowledge sources do not provide information about sending login codes using a custom identity field like customerId. Only email and phone number are documented as supported identifiers for code-based login flows.