curl --request POST \
--url https://api.example.com/api/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"200": {},
"400": {},
"401": {},
"success": true,
"data": {
"user": {
"id": 123,
"email": "<string>",
"nombre": "<string>",
"apellido": "<string>",
"telefono": "<string>",
"role": "<string>"
},
"token": "<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>"
}
'{
"200": {},
"400": {},
"401": {},
"success": true,
"data": {
"user": {
"id": 123,
"email": "<string>",
"nombre": "<string>",
"apellido": "<string>",
"telefono": "<string>",
"role": "<string>"
},
"token": "<string>"
}
}POST /api/auth/login
Show data properties
{
"success": false,
"error": "Credenciales inválidas"
}
curl -X POST https://api.pcfix.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "miPassword123"
}'
const response = await fetch('https://api.pcfix.com/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '[email protected]',
password: 'miPassword123'
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.pcfix.com/api/auth/login',
json={
'email': '[email protected]',
'password': 'miPassword123'
}
)
data = response.json()
print(data)
{
"success": true,
"data": {
"user": {
"id": 123,
"email": "[email protected]",
"nombre": "Juan",
"apellido": "Pérez",
"telefono": "+1234567890",
"role": "USER"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
Authorization header for authenticated requests