Endpoint
Request Body
The user’s username. Must be between 3-50 characters.
The user’s password. Must be at least 8 characters.
Response
JWT access token used to authenticate API requests. This token is short-lived and should be included in the
Authorization header as Bearer {token}.JWT refresh token used to obtain new access tokens when they expire. Store this securely as it is long-lived.
Unix timestamp (seconds since epoch) indicating when the access token expires.
Example Request
Example Response
200 OK
400 Bad Request
401 Unauthorized
Implementation Details
The login endpoint performs the following operations (seeinternal/api/auth/handlers.go:86):
- Request Validation - Validates that username and password are provided
- Credential Verification - Looks up the user and verifies the password using bcrypt
- Token Generation - Generates JWT access and refresh tokens with appropriate expiry times
- Last Login Update - Updates the user’s last login timestamp
- Response - Returns both tokens and expiration time
Security: Failed login attempts are logged for security monitoring. The endpoint is protected by rate limiting to prevent brute force attacks.
Token Claims
The access token JWT contains the following claims:Unique identifier for the user
The user’s username (typically email)
User role: either
ADMIN or STANDARDToken type:
access for access tokens, refresh for refresh tokensToken issuer (application name)
Token subject (username)
Issued at timestamp (Unix epoch)
Expiration timestamp (Unix epoch)
Using the Token
Once authenticated, include the access token in subsequent API requests:Next Steps
Refresh Token
Learn how to refresh expired access tokens
Google OAuth
Alternative authentication using Google