Overview
Homarr supports two primary authentication methods:- Session Authentication - Cookie-based authentication for web clients
- API Key Authentication - Token-based authentication for external applications
Session Authentication
Session authentication is used by the Homarr web interface and is based on NextAuth.js.How It Works
- User logs in via the web interface
- Server creates a session and stores a session token in an HTTP-only cookie
- Subsequent requests include the session cookie automatically
- Server validates the session token on each request
Cookie Details
Session token cookie name. HTTP-only, secure, SameSite=Lax.
Using Session Authentication
For web applications, session authentication is handled automatically:API Key Authentication
API keys allow external applications to authenticate without maintaining a session.Creating an API Key
Only administrators can create API keys.API Key Format
API keys have the format:{id}.{token}
Example: clx1234567890.a1b2c3d4e5f6...
- ID: Identifies the API key in the database
- Token: Secret token used for authentication (64 characters)
Using API Keys
HTTP Headers
Include the API key in theAuthorization header:
tRPC Client
For programmatic access with tRPC:API Key Security
Best Practices:- Store API keys in environment variables, not in code
- Use separate API keys for different applications
- Rotate API keys periodically
- Delete unused API keys immediately
- Never commit API keys to version control
Managing API Keys
List All API Keys
Unique identifier for the API key
ID of the user who owns this API key
Create API Key
Delete API Key
WebSocket Authentication
WebSocket connections authenticate using the session cookie:Permissions
Authenticated requests inherit the permissions of the user or API key owner:- Public procedures: No authentication required
- Protected procedures: Require valid session or API key
- Permission-required procedures: Require specific permissions (e.g.,
admin,board-create)
Common Permissions
| Permission | Description |
|---|---|
admin | Full administrative access |
board-create | Create new boards |
board-view-all | View all boards |
board-modify-all | Modify all boards |
app-create | Create applications |
integration-create | Create integrations |
integration-use-all | Use all integrations |
Troubleshooting
”Unauthorized” Error
- Verify your API key is correct
- Check that the API key hasn’t been deleted
- Ensure the Authorization header is properly formatted
”Forbidden” Error
- Verify the user has the required permissions
- Check that the resource is accessible to the user
