flat-waitress-75076
11/08/2024, 8:13 AMbrief-egg-61061
11/08/2024, 8:13 AMbrief-egg-61061
11/08/2024, 8:13 AM/self-service/login/api
endpoint. 2. Complete the login flow by submitting the credentials to the action URL returned in the first step. 3. Check the response for a successful login. Here's a step-by-step example using curl: bash # Initiate 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": "<mailto:user@example.com|user@example.com>", "password": "yourpassword", "method": "password"}' \ "$actionUrl" | jq
If the login is successful, you'll receive a JSON response containing the session information [Ory Docs - Login API](https://www.ory.sh/docs/kratos/self-service/flows/user-login#api-clients). You can check for the presence of a session_token
in the response to verify if the login was successful. Note that this method will create a session token, but you don't need to use or store it if you just want to verify the account. Simply checking for a successful response is enough to confirm that the credentials are valid. Remember to replace "<mailto:user@example.com|user@example.com>"
and "yourpassword"
with the actual credentials you want to verify. This approach allows you to verify the account without maintaining an active session, as requested.flat-waitress-75076
11/08/2024, 8:13 AMbrief-egg-61061
11/08/2024, 8:14 AMbrief-egg-61061
11/08/2024, 8:14 AM