bland-finland-95044
07/26/2024, 2:36 PMchilly-king-10285
07/26/2024, 2:36 PMchilly-king-10285
07/26/2024, 2:36 PMjson { "schema_id": "<preset://email>", "traits": { "email": "[[email protected]](<https://www.ory.sh/cdn-cgi/l/email-protection>)" }, "credentials": { "password": { "config": { "password": "the-password" } } } }
In this example, the password the-password
will then be hashed according to the configured password hashing algorithm and stored in the database. The identity will be able to sign in using [[email protected]](<https://www.ory.sh/cdn-cgi/l/email-protection>)
and the-password
as credentials.bland-finland-95044
07/26/2024, 3:55 PMchilly-king-10285
07/26/2024, 3:55 PMchilly-king-10285
07/26/2024, 3:55 PMory auth
to sign into your Ory Network account. 3. Locate the session token in the .ory-cloud.json
file in your home folder. This token starts with the prefix ory_st
. You can use cat ~/.ory-cloud.json | grep 'ory_st'
to find it. Here is the relevant extract from the [Ory documentation](https://www.ory.sh/docs/identities/sign-in/saml#configuration): bash # Install the Ory CLI # Follow the instructions at <https://www.ory.sh/docs/guides/cli/installation> # Sign into your Ory Network account ory auth # Locate the session token cat ~/.ory-cloud.json | grep 'ory_st'
Remember, the session token is used to authenticate your requests to the Ory API.bland-finland-95044
07/26/2024, 3:55 PMchilly-king-10285
07/26/2024, 3:55 PMchilly-king-10285
07/26/2024, 3:56 PM/self-service/login/api
endpoint. This will return a JSON payload with an action
URL. 2. Complete the login flow by sending a POST request to the action
URL with the identity's credentials (email and password). This will return a JSON payload with the session token. Here's an example of how to do this with `curl`: bash # Inits a Login Flow actionUrl=$(curl -s -X GET -H "Accept: application/json" "<https://playground.projects.oryapis.com/self-service/login/api>" | jq -r '.ui.action') # Complete Login Flow with password method curl -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{"identifier": "email", "password": "password", "method": "password"}' "$actionUrl" | jq
Replace "email"
and "password"
with the identity's actual email and password. The session token will be in the session_token
field of the returned JSON payload. For more details, see the [Ory Kratos API documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-login#api-clients).bland-finland-95044
07/26/2024, 4:46 PMchilly-king-10285
07/26/2024, 4:46 PMchilly-king-10285
07/26/2024, 4:47 PMid
, stateChangedAt
and credentials
(which includes the password) cannot be updated using this method. Here is the relevant extract from the [Ory API documentation](https://www.ory.sh/docs/reference/api#operation/patchIdentity): bash PATCH /admin/identities/{id}
However, Ory provides a separate endpoint for updating a password. This is done through the Self-Service Flow, which involves initiating a password update flow and then completing it with the new password. Here is a general outline of the process: 1. Initiate a password update flow by sending a GET request to the /self-service/settings/api
endpoint. This will return a JSON payload with an action
URL. 2. Complete the password update flow by sending a POST request to the action
URL with the new password. Here's an example of how to do this with `curl`: bash # Inits a Settings Flow actionUrl=$(curl -s -X GET -H "Accept: application/json" "<https://playground.projects.oryapis.com/self-service/settings/api>" | jq -r '.ui.action') # Complete Settings Flow with password method curl -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{{"password": "new-password", "method": "password"}}' "$actionUrl" | jq
Replace "new-password"
with the new password. For more details, see the [Ory Kratos API documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-settings#api-clients).bland-finland-95044
07/26/2024, 4:56 PMchilly-king-10285
07/26/2024, 4:56 PMchilly-king-10285
07/26/2024, 4:56 PM/self-service/verification/api
endpoint. This will return a JSON payload with an action
URL. 2. Complete the verification flow by sending a POST request to the action
URL with the user's email. Here's an example of how to do this with `curl`: bash # Inits a Verification Flow actionUrl=$(curl -s -X GET -H "Accept: application/json" "<https://playground.projects.oryapis.com/self-service/verification/api>" | jq -r '.ui.action') # Complete Verification Flow with email method curl -s -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{{"email": "user-email", "method": "link"}}' "$actionUrl" | jq
Replace "user-email"
with the user's actual email. This will send a verification email to the user. The user can then click the verification link in the email to verify their email address. For more details, see the [Ory Kratos API documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation#api-clients).bland-finland-95044
08/01/2024, 6:04 PMchilly-king-10285
08/01/2024, 6:04 PMchilly-king-10285
08/01/2024, 6:04 PM