Overview
Jean uses token-based authentication to secure HTTP and WebSocket connections. Authentication can be optionally enabled/disabled via server configuration.Token Generation
Tokens are cryptographically random 32-byte strings encoded with base64url:Kj8vN2Qw1xYzM4P7R6Sf9T3Uc0Vd5We8Xf1Yg4Zh7Ai2Bj
Server Configuration
Authentication is configured when starting the HTTP server:The authentication token (generated automatically)
Whether authentication is enforced. Set to
false to disable authentication.Authentication Methods
HTTP Query Parameter
Provide the token as a query parameter:WebSocket Query Parameter
Include the token when upgrading to WebSocket:Endpoints
Validate Token
true if the token is valid, false otherwiseWhether authentication is enabled on the server. Only present when
token_required = false.Error message when token validation fails. Only present on failure.
WebSocket Authentication
Connection Flow
- Upgrade Request: Client sends HTTP GET to
/ws?token=YOUR_TOKEN - Validation: Server validates the token (if
token_required = true) - Upgrade: On success, connection is upgraded to WebSocket
- Event Stream: Client receives real-time events
JavaScript Example
Python Example
Token Validation
The server uses constant-time comparison to prevent timing attacks:Security Considerations
Transport Security
Transport Security
The API currently uses unencrypted HTTP/WebSocket. For production deployments:
- Use a reverse proxy with TLS (nginx, Caddy)
- Enable
localhost_onlymode for local development - Consider implementing HTTPS support in the server
Token Storage
Token Storage
- Store tokens securely (environment variables, secure config files)
- Never commit tokens to version control
- Rotate tokens periodically
- Use different tokens for different environments
Network Exposure
Network Exposure
When
localhost_only = false, the server is accessible on the LAN:- Ensure firewall rules are configured properly
- Use strong, random tokens
- Consider IP allowlisting
Disabling Authentication
Disabling Authentication
Setting
token_required = false disables all authentication:- Only use in trusted environments
- Never expose to the internet without authentication
- Useful for internal tools and testing
Error Codes
| Status | Description |
|---|---|
200 OK | Token is valid or authentication is disabled |
401 Unauthorized | Token is missing, empty, or invalid |
500 Internal Server Error | Server-side error during validation |
Next Steps
API Overview
Learn about the API architecture
Projects API
Start managing projects