This endpoint authenticates a user with their username and password, returning a JWT (JSON Web Token) for subsequent authenticated requests.
Request Body
The username of the user. Cannot be blank.
The password of the user. Cannot be blank.
Response
The username of the authenticated user.
A confirmation message about the login status.
The JWT (JSON Web Token) access token for subsequent authenticated requests. This token should be included in the Authorization header as a Bearer token for protected endpoints. Example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
A boolean indicating the success of the login operation.
curl -X POST https://api.example.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "johndoe",
"password": "securePassword123"
}'
201 - Success
400 - Bad Request
401 - Unauthorized
500 - Internal Server Error
{
"username" : "johndoe" ,
"message" : "Login successful" ,
"jwt" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huZG9lIiwiaWF0IjoxNzA5NzI0OTMwLCJleHAiOjE3MDk4MTEzMzB9.1x2y3z4a5b6c7d8e9f0g1h2i3j4k5l6m7n8o9p0q1r2" ,
"status" : true
}