gray-machine-46287
02/06/2025, 3:13 PMbrief-egg-61061
02/06/2025, 3:13 PMbrief-egg-61061
02/06/2025, 3:13 PMPOST /admin/identities
endpoint to create a new identity. This allows you to set up a user account without requiring a password. Here's an example of how to create an identity: json { "schema_id": "<preset://email>", "traits": { "email": "<mailto:user@example.com|user@example.com>" }, "credentials": { "password": { "config": { "hashed_password": "", "use_password_migration_hook": true } } } }
2. Update an existing identity: If the user already exists, you can use the PUT /admin/identities/{id}
endpoint to update the identity. This allows you to modify user information or credentials without knowing the password. Both of these methods require an API Key for authentication. Make sure you have the necessary permissions to access these admin APIs. It's important to note that while you can create or update an identity without a password, the user won't be able to log in until a password is set. You have a few options to handle this: 1. Use a password migration hook: By setting use_password_migration_hook
to true
, you can implement a custom hook to handle password migration when the user first attempts to log in. 2. Use account recovery: You can trigger account recovery for the user, which will allow them to set a new password. 3. Use passwordless authentication: Ory Kratos supports passwordless authentication methods like email one-time codes or WebAuthn/passkeys, which could be a good alternative if you don't want to deal with passwords at all. For more detailed information on managing identities and using admin APIs, you can refer to the following resources: - [Manage Identities Documentation](https://www.ory.sh/docs/kratos/manage-identities/managing-users-identities-metadata) - [Identity API Reference](https://www.ory.sh/docs/kratos/reference/api) Remember to always handle user data securely and in compliance with relevant data protection regulations.gray-machine-46287
02/06/2025, 3:15 PM