polite-lizard-84910
01/11/2024, 8:19 AMchilly-king-10285
01/11/2024, 8:19 AMchilly-king-10285
01/11/2024, 8:19 AMbash password=ByS8NWuFSkDgMjbe actionUrl=$(curl -s -H "Accept: application/json" \ -H "Authorization: bearer $sessionToken" \ '<https://playground.projects.oryapis.com/self-service/settings/api>' | jq -r '.ui.action') curl -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" \ -H "Authorization: bearer $sessionToken" \ -d '{"password": "'$password'", "method": "password"}' \ "$actionUrl" | jq
In this example, sessionToken
is the session token for the user whose password you want to change, and password
is the new password. The actionUrl
is obtained by making a GET request to the settings API endpoint. Please note that this is a general example and might need to be adjusted based on your specific setup and requirements. For more detailed information, please refer to the [Ory Kratos documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#api-clients-and-clients-without-browsers).polite-lizard-84910
01/11/2024, 8:22 AMchilly-king-10285
01/11/2024, 8:22 AMchilly-king-10285
01/11/2024, 8:22 AMPUT /admin/identities/{id}
endpoint. However, the extracts provided do not include specific details on how to update the password field. Here is a general example of how you might use this endpoint: bash curl -X PUT "<https://your-kratos-server.com/admin/identities/{id}>" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "schema_id": "default", "traits": { //... other traits }, "credentials": { "password": { "config": { "hashed_password": "new-hashed-password" } } } }'
In this example, replace {id}
with the ID of the identity you want to update, and new-hashed-password
with the new hashed password. Please note that Kratos expects the password to be hashed. However, it's important to note that the Kratos documentation recommends updating credentials (including passwords) via the relevant flows (like the settings flow) rather than directly through the admin API. This is because the flows handle things like validation, and ensure that related hooks and strategies are correctly executed. For more detailed information, please refer to the [Ory Kratos documentation](https://www.ory.sh/docs/kratos/).