/api/auth.
Authentication endpoints are only available when
DB_ENABLED=true is set in the environment configuration. In LAN mode, these routes are disabled.Register User
Request Body
The username for the new account. Must be unique.
The email address for the new account. Must be unique and not already registered.
The password for the new account. Will be hashed before storage.
Response
Success or error message describing the result of the registration attempt.
Login User
Request Body
The username of the account to log in.
The password for the account.
Response
JWT authentication token valid for 1 hour. Contains user ID and username in the payload.
Error message if authentication fails.
JWT Token Payload
The JWT token contains the following payload structure:Tokens expire after 1 hour. Clients should handle token expiration and prompt users to re-authenticate.
Health Check
Response
Always returns
true when the server is operational.Current server timestamp in milliseconds (Unix epoch).
The hostname from the request.
The
/ping endpoint does not require authentication and is always available regardless of database configuration.Security Notes
Implementation Reference
Authentication logic is implemented in:- Routes:
Backend/routes/authRoutes.js:7-13 - Controller:
Backend/controllers/authController.js - Server configuration:
Backend/server.js:38-49