Identity Schema, Custom Fields
The Identity Schema is a JSON Schema which describes your identity's (e.g. your customers / users / ...) fields. In Ory, every identity can have their own model, allowing you to separate between different customer types, user types (e.g. employees and customers). For technical information on Identity Schemas, check out the open source documentation:
The Identity Schema can either be one of the available presets or a customized model.
Available Presets​
Ory Cloud provides three basic Identity Schema Presets.
Only Username​
This preset is useful for applications that do not require email addresses and a high degree of anonymity.
note
This preset disables account verification, account recovery, and account enumeration defenses! Do not use it in security-sensitive environments.
With this preset, every identity has exactly one trait - the username
- which
is used as the login identifier:
// Identity example
{
id: '6e9d3d30-f93e-4630-901f-c2096953723d',
traits: {
username: 'some-username'
}
}
Only Email​
With this preset, identities have exactly one trait, the email
. It is used as
the login identifier, for email verification, and for account recovery:
// Identity example
{
id: '6e9d3d30-f93e-4630-901f-c2096953723d',
traits: {
email: 'foo@bar.com'
}
}
Demo Profile​
warning
This profile is EXPERIMENTAL and is encouraged to be used only in PoCs and demos. It will eventually be removed!
The "Demo Profile" preset has - similar to the "Only Email" preset - an email field and additionally a first name, last name, and a checkbox.
// Identity example
{
id: '6e9d3d30-f93e-4630-901f-c2096953723d',
traits: {
email: 'foo@bar.com',
name: {
first: 'Foo',
last: 'Bar'
},
newsletter: true
}
}
Custom Identity Schema​
Ory gives you the option to add custom fields to your Identity Schema.
You can define new traits for an identity, save the identity as a template and switch between different Identity Schemas.
For a hands-on guide on how to create a custom Identity Schema, please head over to this document: Customize Identity Schema Guide.