Endpoint
This endpoint authenticates a user with email and password, returning a JWT token valid for 10 days.
Request Body
The user’s email address. Email must belong to an active user account.
The user’s password. Password is verified using secure hashing.
Response
Indicates whether the authentication was successful. Returns
true on success, false on failure.JWT authentication token. Valid for 10 days from generation. Empty string if authentication fails.
User information object. Returns
null if authentication fails.JWT Token Details
The API generates JWT tokens with the following characteristics:- Algorithm: HMAC-SHA256
- Expiration: 10 days from generation
- Claims: Includes user ID (
NameIdentifierclaim) - Usage: Include token in
Authorizationheader asBearer {token}for authenticated requests
Example Request
Example Response
Success Response (200 OK)
Failed Response (200 OK)
Authentication Failure Reasons
The login will fail (Respuesta: false) in the following scenarios:
- Invalid Email: The provided email does not exist in the system
- Inactive Account: The user account exists but is marked as inactive
- Invalid Password: The password does not match the stored password hash
- Invalid Credentials: General authentication failure
For security reasons, the API does not distinguish between different failure reasons in the response.
Using the Token
Once you receive a token, include it in theAuthorization header for subsequent authenticated requests:
Security Considerations
- Store the JWT token securely (e.g., HTTP-only cookies, secure storage)
- Never expose tokens in URLs or logs
- Implement token refresh mechanism before expiration
- Use HTTPS in production to prevent token interception
- Validate token on server-side for every protected request