Login
Authenticate with your credentials to obtain an access token.
POST
/api/v1/auth/loginDescription
The login endpoint authenticates a user with their client credentials (client_id and client_secret), returning a JSON Web Token valid for 4 hours. The token should be included in the Authorization header for all subsequent API requests.
Request
Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| client_id | string | Yes | Your email address or client identifier |
| client_secret | string | Yes | Your password or client secret |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
| message | string | Status message indicating successful login |
| token | string | JWT token valid for 4 hours |
Error Responses
Common error responses you may encounter when using this endpoint.
Notes
- Access tokens expire after 4 hours. Use the refresh token endpoint to obtain a new token without re-authenticating.
- Always include the Bearer Token in the Authorization header for secured endpoints.
- Failed login attempts are rate-limited to prevent brute force attacks.
- Store tokens securely on the client-side to prevent unauthorized access. Never expose them in version control.
Related Endpoints
Did this page help you?
Request Example
curl -X POST https://dev-api.unduit.com/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"client_id": "jane.smith@example.com",
"client_secret": "your-password"
}'Success Response (200)
{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiZW1haWwiOiJmYWlyd2F5aW5kZXBlbmRlbnRtb3J0Z2FnZWNvcnBvcmF0aW9uQHVuZHVpdC5jb20iLCJjb21wYW55X2lkIjozMTcsImlhdCI6MTczMzM5Mzk5NSwiZXhwIjoxNzMzMzk3NTk1fQ.qvWAgXO-AUr5-JurBC_cBMJ1y-SWJmkcTlihS-n5gjw"
}Error Responses
401 Unauthorized
{
"message": "Invalid email or password"
}400 Bad Request
{
"message": "Missing required fields: client_id, client_secret"
}429 Too Many Requests
{
"message": "Too many login attempts. Please try again later."
}