Endpoint
Authenticate a user with email and password credentials
Authentication
This endpoint does not require authentication (public endpoint).Request Body
User’s email address or username
User’s password
Response
Indicates whether the login was successful
Human-readable message describing the result
JWT access token for authenticated requests (only present on success)
User data object (only present on success)
Example Request
Example Response
Success Response (200 OK)
Error Response (401 Unauthorized)
Error Codes
| Status Code | Description |
|---|---|
| 200 | Login successful |
| 401 | Invalid username or password |
| 422 | Validation error (missing fields) |
| 429 | Too many login attempts |
| 500 | Internal server error |
Token Usage
The returned JWT token should be included in theAuthorization header for all authenticated requests:
The token is automatically stored in memory and persisted to secure storage. All subsequent API requests will include the token via the Dio interceptor (see
api_service.dart:35).Token Lifecycle
- Tokens are cached in memory for performance (
_cachedToken) - Tokens are persisted to
SharedPreferencesfor session continuity - On 401 errors, the token is automatically cleared
- The
onUnauthorizedcallback is triggered to redirect to login
Related Endpoints
- Change Password - Update user password
