Authentication
Endpoints for user authentication and token management.
Authentication is handled via secure HTTP-only cookies for JWT tokens and CSRF protection.
POST /api/login
Authenticate a user and receive authentication tokens via cookies.
- Method: POST
- Path:
/api/login
- Source: handlers.go
Request Body
Response
Cookies Set
access_token
: JWT access token (HTTP-only)refresh_token
: JWT refresh token (HTTP-only)csrf_token
: CSRF protection tokenupload_key
: Upload key for image uploads (HTTP-only)
Example
Errors
- 400: Invalid request
- 401: Invalid credentials
- 500: Internal server error
POST /api/logout
Logout the current user by clearing authentication cookies.
- Method: POST
- Path:
/api/logout
- Source: handlers.go
Response
Example
POST /api/refresh
Refresh the access token using the refresh token cookie.
- Method: POST
- Path:
/api/refresh
- Source: handlers.go
Response
Cookies Updated
access_token
: New JWT access tokenrefresh_token
: New JWT refresh tokencsrf_token
: New CSRF token
Example
Errors
- 401: No refresh token or invalid refresh token
- 500: Internal server error
POST /api/verify
Verify the current authentication state.
- Method: POST
- Path:
/api/verify
- Source: handlers.go
Response
Example
Errors
- 401: Not authenticated
- 500: Internal server error