curl --request POST \
--url https://api.example.com/api/v1/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"phone": "<string>",
"password": "<string>"
}
'{
"status": 123,
"data": {
"token": "<string>",
"token_type": "<string>",
"user": {
"id": 123,
"name": "<string>",
"email": "<string>",
"roles": [
{
"id": 123,
"name": "<string>"
}
],
"permissions": [
{
"id": 123,
"name": "<string>"
}
]
}
}
}Authenticate a user and receive an access token
curl --request POST \
--url https://api.example.com/api/v1/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"phone": "<string>",
"password": "<string>"
}
'{
"status": 123,
"data": {
"token": "<string>",
"token_type": "<string>",
"user": {
"id": 123,
"name": "<string>",
"email": "<string>",
"roles": [
{
"id": 123,
"name": "<string>"
}
],
"permissions": [
{
"id": 123,
"name": "<string>"
}
]
}
}
}phone is not provided.Validation: Must be a valid email format.Example: [email protected]email is not provided.Validation: Maximum 20 characters.Example: +525512345678password123email or phone, but not both. The system will authenticate using whichever identifier is provided.Show data properties
eyJ0eXAiOiJKV1QiLCJhbGc...Show user properties
{
"status": 200,
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoiLCJpYXQiOjE3MDk4NTYwMDAsIm5iZiI6MTcwOTg1NjAwMCwiZXhwIjoxNzQxMzkyMDAwLCJzdWIiOiIxIiwic2NvcGVzIjpbXX0...",
"token_type": "Bearer",
"user": {
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"roles": [
{
"id": 1,
"name": "admin"
}
],
"permissions": [
{
"id": 5,
"name": "view-items"
},
{
"id": 12,
"name": "create-inventory"
}
]
}
}
}
Show 422 Unprocessable Entity - Invalid Credentials
{
"message": "The provided credentials are incorrect.",
"errors": {
"email": [
"The provided credentials are incorrect."
]
}
}
{
"message": "The provided credentials are incorrect.",
"errors": {
"phone": [
"The provided credentials are incorrect."
]
}
}
Show 422 Unprocessable Entity - Validation Error
{
"message": "The given data was invalid.",
"errors": {
"email": [
"Email is required when phone is not provided."
],
"password": [
"The password field is required."
]
}
}
Show 500 Internal Server Error
{
"status": 500,
"message": "An unexpected error occurred"
}
curl -X POST https://api.sushigo.local/api/v1/auth/login \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"email": "[email protected]",
"password": "password123"
}'
token securely (e.g., in localStorage or a secure cookie)Authorization: Bearer {token} header