billions-minister-2901
05/19/2025, 3:47 PMbrief-egg-61061
05/19/2025, 3:47 PMbrief-egg-61061
05/19/2025, 3:47 PMjson { "traits": { "username": { "type": "string", "<http://ory.sh/kratos|ory.sh/kratos>": { "credentials": { "password": { "identifier": true } } } } } } This tells Ory that the username field can be used to log in with a password. You can also allow both username and email as identifiers by marking both fields this way in your schema[Customize identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema/#username-and-email-and-password). 2. Create or update the user with the username and password When creating or importing a user, include the username in the traits and provide the password in the credentials section. For example, to import a user with a clear text password: json { "schema_id": "your-schema-id", "traits": { "username": "myuser" }, "credentials": { "password": { "config": { "password": "the-password" } } } } This can be done using the /admin/identities endpoint. The password will be hashed and stored securely. The user will then be able to log in using their username and password[Importing credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities/#importing-credentials). Summary: - Mark the username field as a password identifier in your identity schema. - Create or update the user with the username in traits and the password in credentials. For more details and examples, see the documentation on [customizing identity schemas](https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema/#username-and-email-and-password) and [importing credentials](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities/#importing-credentials).billions-minister-2901
05/19/2025, 4:34 PMbrief-egg-61061
05/19/2025, 4:34 PMbrief-egg-61061
05/19/2025, 4:34 PM