curl --request POST \
--url https://api.example.com/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"access_token": "<string>",
"token_type": "<string>",
"usuario": {
"usuario.id": "<string>",
"usuario.nombre": "<string>",
"usuario.email": "<string>",
"usuario.rol": "<string>"
},
"401 Unauthorized": {},
"422 Unprocessable Entity": {}
}Authenticate a user and receive a JWT access token
curl --request POST \
--url https://api.example.com/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'{
"access_token": "<string>",
"token_type": "<string>",
"usuario": {
"usuario.id": "<string>",
"usuario.nombre": "<string>",
"usuario.email": "<string>",
"usuario.rol": "<string>"
},
"401 Unauthorized": {},
"422 Unprocessable Entity": {}
}curl -X POST https://api.tesisrutas.com/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123"
}'
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUwN2YxZjc3YmNmODZjZDc5OTQzOTAxMSIsImVtYWlsIjoibWFyaWFAZXhhbXBsZS5jb20iLCJyb2wiOiJ2aXNpdGFudGUifQ.xyz123",
"token_type": "bearer",
"usuario": {
"id": "507f1f77bcf86cd799439011",
"nombre": "María González",
"email": "[email protected]",
"rol": "visitante"
}
}
curl -X GET https://api.tesisrutas.com/rutas \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
id: User’s unique identifieremail: User’s email addressrol: User’s role for authorization purposes{
"detail": "Credenciales inválidas"
}
{
"detail": [
{
"loc": ["body", "email"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Bearer YOUR_ACCESS_TOKEN