curl --request POST \
--url https://api.example.com/api/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"success": true,
"user": {
"id": "<string>",
"email": "<string>",
"name": "<string>",
"email_verified": true,
"created_at": "<string>",
"updated_at": "<string>"
},
"key_salt": "<string>",
"verification_blob": {},
"encrypted_keys": [
{
"account_id": "<string>",
"encrypted_key": "<string>",
"key_version": 123
}
],
"csrfToken": "<string>",
"error": "<string>",
"code": "<string>"
}Authenticate a user with email and password
curl --request POST \
--url https://api.example.com/api/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"success": true,
"user": {
"id": "<string>",
"email": "<string>",
"name": "<string>",
"email_verified": true,
"created_at": "<string>",
"updated_at": "<string>"
},
"key_salt": "<string>",
"verification_blob": {},
"encrypted_keys": [
{
"account_id": "<string>",
"encrypted_key": "<string>",
"key_version": 123
}
],
"csrfToken": "<string>",
"error": "<string>",
"code": "<string>"
}httpOnly: true (not accessible via JavaScript)secure: true in productionsameSite: 'none' in production, 'lax' in developmentcurl -X POST https://api.homeaccount.app/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "SecurePass123!"
}'
{
"success": true,
"user": {
"id": "usr_1a2b3c4d5e6f",
"email": "[email protected]",
"name": "John Doe",
"email_verified": true,
"created_at": "2024-01-15T10:30:00.000Z",
"updated_at": "2024-03-05T14:20:00.000Z"
},
"key_salt": "a1b2c3d4e5f6789...",
"verification_blob": "ZW5jcnlwdGVkX3Zlcml...",
"encrypted_keys": [
{
"account_id": "acc_9z8y7x6w5v4u",
"encrypted_key": "U2FsdGVkX1+abcdef...",
"key_version": 1
}
],
"csrfToken": "csrf_abc123xyz..."
}
{
"success": false,
"error": "Email inválido"
}
{
"success": false,
"error": "Invalid email or password"
}
{
"success": false,
"error": "Debes verificar tu email antes de iniciar sesión.",
"code": "EMAIL_NOT_VERIFIED",
"email": "[email protected]"
}
loginRateLimiter)tokenServicesecure: true and sameSite: 'none'backend/controllers/auth/auth-controller.ts:95
Route: backend/routes/auth/auth-routes.ts:47