Skip to main content
POST
Login
Authenticates a user with email and password. Returns Cognito access/id/refresh tokens on success, or a NEW_PASSWORD_REQUIRED challenge on first login when an admin has created the account with a temporary password.

Authentication

This is a public endpoint that does not require authentication.

Rate Limiting

This endpoint is rate-limited to 5 requests per minute per IP address.

Request Body

string
required
User email address (case-insensitive, will be lowercased automatically)Must be a valid email format.Example: user@example.com
string
required
User passwordMust be at least 8 characters long.Example: MyP@ssw0rd!

Request Example

Response

Success Response (200 OK)

The response varies depending on whether this is a first-time login:

Standard Login Success

string
Cognito JWT access token used for API authenticationPass this token in the Authorization: Bearer <token> header for authenticated requests.
string
Cognito refresh token used to obtain new access tokensUse this with the /api/auth/refresh-token endpoint when the access token expires.
number
Token expiration time in secondsTypically 3600 (1 hour).
boolean
Indicates whether a password change is requiredWill be false for standard login success.

First-Time Login (Password Change Required)

When an admin creates a user account with a temporary password, the first login returns a challenge:
boolean
Set to true to indicate password change is required
string
Session token for completing the password change challengeMust be provided to the /api/auth/complete-password-change endpoint.
string
Username (email) of the account

Error Responses

Validation error — Invalid email format or password too short
Invalid credentials — Email or password is incorrectThe response is intentionally generic to prevent user enumeration attacks.
Rate limit exceeded — More than 5 requests in 1 minute

Notes

  • Email addresses are automatically lowercased and trimmed for consistency
  • The endpoint returns generic error messages on authentication failure to prevent user enumeration
  • Access tokens are JWTs that expire after 1 hour (3600 seconds)
  • Refresh tokens are long-lived and can be used to obtain new access tokens without re-entering credentials
  • On first login with a temporary password, you must complete the password change flow using /api/auth/complete-password-change