limited-city-59768
03/16/2024, 1:10 PMchilly-king-10285
03/16/2024, 1:10 PMchilly-king-10285
03/16/2024, 1:10 PMjson { "$id": "<https://example.com/registration.schema.json>", "$schema": "<http://json-schema.org/draft-07/schema#>", "title": "Person", "type": "object", "properties": { "traits": { "type": "object", "properties": { "emails": { "type": "array", "items": { "type": "string", "format": "email", "<http://ory.sh/kratos|ory.sh/kratos>": { "credentials": { "password": { "identifier": true } } } } } } } }
In this schema, the emails
field is an array, allowing for multiple email addresses. Each email address is a string in the format of an email, and each can be used as an identifier for the password credential. For more information, you can refer to the [Ory Kratos documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#examples).limited-city-59768
03/16/2024, 1:12 PMchilly-king-10285
03/16/2024, 1:12 PMchilly-king-10285
03/16/2024, 1:12 PMjson { "$id": "<https://example.com/ory.schema.json>", "$schema": "<http://json-schema.org/draft-07/schema#>", "additionalProperties": false, "properties": { "traits": { "additionalProperties": false, "properties": { "email": { "format": "email", "<http://ory.sh/kratos|ory.sh/kratos>": { "credentials": { "password": { "identifier": true }, "webauthn": { "identifier": true }, "totp": { "account_name": true } }, "recovery": { "via": "email" }, "verification": { "via": "email" } }, "title": "Email address", "type": "string", "maxLength": 320 }, "email_secondary": { "format": "email", "<http://ory.sh/kratos|ory.sh/kratos>": { "recovery": { "via": "email" }, "verification": { "via": "email" } }, "title": "Email address secondary", "type": "string", "maxLength": 320 } }, "type": "object" } }, "title": "Person", "type": "object" }
In this schema, both email
and email_secondary
fields are defined as recovery addresses. This means that Ory will send recovery messages to both addresses when the recovery flow is initiated. The user should provide the email_secondary
field during registration or update it later in their account settings so it can be used in the recovery process. For more information, you can refer to the [Ory Kratos documentation on account recovery and password reset](https://www.ory.sh/docs/kratos/self-service/flows/account-recovery-password-reset#fallback-recovery-address).limited-city-59768
03/16/2024, 1:14 PMchilly-king-10285
03/16/2024, 1:14 PMchilly-king-10285
03/16/2024, 1:14 PMjson { "$id": "<https://example.com/registration.schema.json>", "$schema": "<http://json-schema.org/draft-07/schema#>", "title": "Person", "type": "object", "properties": { "traits": { "type": "object", "properties": { "emails": { "type": "array", "items": { "type": "string", "format": "email", "<http://ory.sh/kratos|ory.sh/kratos>": { "credentials": { "password": { "identifier": true } } } } } } } } }
However, the exact API call to register a user with multiple emails depends on your implementation of the registration flow. Ory Kratos does not provide a specific API endpoint for this purpose. Instead, you would typically create a registration form in your application that corresponds to the customized identity schema, and then submit the form data to the Kratos API. For more information, you can refer to the [Ory Kratos documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#examples) and the [Ory Kratos API reference](https://www.ory.sh/docs/kratos/reference/api).limited-city-59768
03/16/2024, 6:53 PMchilly-king-10285
03/16/2024, 6:53 PMchilly-king-10285
03/16/2024, 6:53 PMtraits
should be defined in a JSON format, and the emails
field should be an array of strings, each representing an email address. Here is an example of how you can define multiple emails: json { "traits": { "emails": [ "<mailto:email1@example.com|email1@example.com>", "<mailto:email2@example.com|email2@example.com>" ] } }
In this example, <mailto:email1@example.com|email1@example.com>
and <mailto:email2@example.com|email2@example.com>
are the email addresses associated with the account. The user can use any of these emails to log in. For more information, you can refer to the [Ory Kratos documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#examples).limited-city-59768
03/16/2024, 6:57 PMchilly-king-10285
03/16/2024, 6:57 PMchilly-king-10285
03/16/2024, 6:57 PMtraits
should be defined in a JSON format, and the emails
field should be an array of strings, each representing an email address. Here is an example of how you can define multiple emails: json {{ "traits": {{ "emails": [ "<mailto:email1@example.com|email1@example.com>", "<mailto:email2@example.com|email2@example.com>" ] }} }}
In this example, <mailto:email1@example.com|email1@example.com>
and <mailto:email2@example.com|email2@example.com>
are the email addresses associated with the account. The user can use any of these emails to log in. For more information, you can refer to the [Ory Kratos documentation on customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#examples).limited-city-59768
03/16/2024, 8:02 PMchilly-king-10285
03/16/2024, 8:02 PMchilly-king-10285
03/16/2024, 8:03 PMverification
and recovery
fields for multiple emails, you would need to define each email in the traits
section of your identity schema as an object with its own verification
and recovery
fields. However, the current version of Ory Kratos does not support this functionality directly. Here's an example of how you might expect to define it: json { "traits": { "emails": [ { "email": "<mailto:email1@example.com|email1@example.com>", "<http://ory.sh/kratos|ory.sh/kratos>": { "verification": { "via": "email" }, "recovery": { "via": "email" } } }, { "email": "<mailto:email2@example.com|email2@example.com>", "<http://ory.sh/kratos|ory.sh/kratos>": { "verification": { "via": "email" }, "recovery": { "via": "email" } } } ] } }
However, please note that this is a hypothetical example and may not work with the current version of Ory Kratos. As of now, Ory Kratos expects a single email field for verification and recovery. For more information, you can refer to the [Ory Kratos documentation on identity schemas](https://www.ory.sh/docs/kratos/manage-identities/identity-schema).