-
Notifications
You must be signed in to change notification settings - Fork 11
Authentication
Configure user authentication and access control for MyGarage. Choose between no authentication, local JWT authentication, or OIDC/SSO integration.
MyGarage supports three authentication modes:
| Mode | Use Case | Security Level | Setup Complexity |
|---|---|---|---|
| None | Local, testing, single-user behind firewall | Easy | |
| Local | Single-user or family deployments, traditional login | ✅ High | Easy |
| OIDC | Multi-user, enterprise SSO, centralized authentication | ✅ Very High | Medium |
- Default mode on first install
- No login required - anyone with URL can access
⚠️ NOT RECOMMENDED for public-facing deployments- Best for local testing or behind trusted reverse proxy with external auth
When running in none mode, MyGarage displays:
- Red banner: "
⚠️ Authentication disabled - anyone can access this instance" - Startup logs: "WARNING: Running without authentication"
✅ Appropriate:
- Local development (
localhostonly) - Single-user homelab behind firewall
- Behind reverse proxy with authentication (Authelia, oauth2-proxy)
- Testing/demo environments
❌ Never Use When:
- Exposed to public internet
- Contains sensitive data (loan docs, insurance)
- Multiple users accessing
After MyGarage is running, set the authentication mode in the web UI:
- Visit Settings → System
- Change Authentication Mode to None
- Save settings (takes effect immediately)
- Traditional username/password authentication
- JWT-based sessions with HttpOnly cookies
- Argon2id password hashing (100MB memory cost, time cost 2)
- Multi-user support with role-based access control
- Recommended for most self-hosted deployments
- ✅ Argon2id Hashing - Industry-leading password hashing
- ✅ JWT Tokens - Stateless session management
- ✅ HttpOnly Cookies - Prevent XSS attacks
- ✅ SameSite Protection - CSRF mitigation
- ✅ Rate Limiting - 5 login attempts per minute
- ✅ Secure Flag - Auto-enabled in production (HTTPS)
Via Web UI:
- Visit Settings → System
- Change Authentication Mode to Local
- Save settings (takes effect immediately)
- Visit the web interface — you'll see the registration page
JWT Secret: Auto-generated and saved to /data/secret.key on first startup. Back up this file — losing it invalidates all existing login sessions.
Optional Environment Variable (Advanced):
JWT_COOKIE_SECURE=auto # auto (default), true (HTTPS only), false (HTTP allowed)After enabling local auth:
- Restart MyGarage
- Visit web interface
- You'll see registration page: "Create First User"
- Fill in:
- Email - Your email address (used for login)
- Password - Strong password (min 8 chars)
- Confirm Password
- Click "Create Account"
- First user automatically becomes admin
- Minimum length: 8 characters
-
Recommended: 12+ characters with mix of:
- Uppercase letters
- Lowercase letters
- Numbers
- Special characters
Weak passwords rejected:
- ❌ "password", "12345678", "qwerty"
- ❌ Common dictionary words
- ❌ Repeated characters ("aaaaaaaa")
- Login as admin
- Go to Settings → Users
- Click "Add User"
- Fill in:
- Email - User's email address
- Password - Temporary password (user should change)
- Role - Admin or Standard User
- Assigned Vehicles - Which vehicles user can access (optional)
- Click "Create User"
- Share credentials with new user (securely!)
Admin:
- ✅ Access all vehicles
- ✅ Manage users (add, edit, delete)
- ✅ Configure system settings
- ✅ View all service records and documents
- ✅ Export all data
Standard User:
- ✅ Access assigned vehicles only
- ✅ Add/edit service records for assigned vehicles
- ✅ Upload documents for assigned vehicles
- ❌ Cannot manage users
- ❌ Cannot change system settings
- ❌ Cannot access other users' vehicles
Vehicles can be assigned to multiple users:
- Go to vehicle detail page
- Click "Settings" → "Sharing"
- Select users to share with
- Click "Save"
All assigned users can view/edit:
- Vehicle info
- Service records
- Fuel logs
- Documents
If user forgets password:
- Login as admin
- Go to Settings → Users
- Click user → "Reset Password"
- Enter new temporary password
- Click "Save"
- User must change password on next login
Users can change their own password:
- Login
- Click profile icon (top-right)
- "Change Password"
- Enter:
- Current password
- New password
- Confirm new password
- Click "Update Password"
- Integrate with external identity providers
- Centralized user management
- Single Sign-On (SSO) across services
- Enterprise-grade security
- Supports: Authentik, Keycloak, Google, Azure AD, Okta, and any standards-compliant OIDC provider
| Provider | Tested | Configuration Complexity |
|---|---|---|
| Authentik | ✅ Yes | Medium |
| Keycloak | ✅ Yes | Medium |
| Google Workspace | ✅ Yes | Easy |
| Azure AD (Entra ID) | ✅ Yes | Medium |
| Okta | Medium | |
| Auth0 | Easy | |
| Generic OIDC | ✅ Yes | Varies |
Your OIDC provider must support:
- OpenID Connect (OIDC) protocol
- Authorization Code Flow
- ID tokens with
emailclaim - HTTPS (HTTP not supported for OIDC)
MyGarage refuses to fetch OIDC metadata from an issuer that resolves to a private/internal IP (SSRF protection). If your provider is self-hosted and its public hostname resolves to a private/LAN address on your network (split-horizon DNS), allow-list that hostname:
MYGARAGE_TRUSTED_HOSTS=auth.example.com # comma-separated hostnames, IPs, or CIDRsThis relaxes the private-IP check for the listed hosts only; all other SSRF protections remain in effect.
Via Web UI:
- Visit Settings → System
- Change Authentication Mode to OIDC
- Configure OIDC settings:
- Provider Name - Display name (e.g., "Authentik")
- Issuer URL - Your OIDC provider's issuer endpoint
- Client ID - From your identity provider
- Client Secret - From your identity provider
- Redirect URI - Auto-generated (copy this to your provider)
-
Scopes - Required scopes (default:
openid profile email)
- Click "Test Connection" to verify configuration
- Save settings (takes effect immediately)
- Visit the web interface → click "Login with SSO"
-
Create an application + provider in Authentik:
- Applications → Applications → Create; Name:
MyGarage, Slug:mygarage - Add a new OAuth2/OIDC provider, Client Type: Confidential
- Redirect URI: copy the Redirect URI shown in MyGarage's OIDC settings
- Applications → Applications → Create; Name:
-
MyGarage UI Configuration (Settings → System → OIDC):
-
Provider Name:
Authentik -
Issuer URL:
https://auth.example.com/application/o/mygarage/ - Client ID / Client Secret: from the Authentik provider
-
Scopes:
openid profile email
-
Provider Name:
-
Create Client in Keycloak:
- Go to Clients → Create Client
- Client ID:
mygarage - Client Protocol:
openid-connect - Access Type: Confidential
-
Configure Client:
- Valid Redirect URIs: Copy from MyGarage UI after configuration
- Web Origins:
https://mygarage.example.com - Get client secret from Credentials tab (copy this!)
-
MyGarage UI Configuration (Settings → System → OIDC):
-
Provider Name:
Keycloak -
Issuer URL:
https://keycloak.example.com/realms/myrealm -
Client ID:
mygarage - Client Secret: Paste from Keycloak
-
Scopes:
openid profile email - Copy Redirect URI and add to Keycloak client
-
Provider Name:
-
Create OAuth 2.0 Client in Google Cloud Console:
- Go to https://console.cloud.google.com/apis/credentials
- Create Credentials → OAuth 2.0 Client ID
- Application type: Web application
- Authorized redirect URIs: Copy from MyGarage UI after configuration
-
Copy Client ID and Secret (shown after creation)
-
MyGarage UI Configuration (Settings → System → OIDC):
-
Provider Name:
Google -
Issuer URL:
https://accounts.google.com -
Client ID: Paste from Google (e.g.,
123456.apps.googleusercontent.com) - Client Secret: Paste from Google
-
Scopes:
openid profile email - Copy Redirect URI and add to Google Cloud Console
-
Provider Name:
-
Register Application in Azure Portal:
- Go to Azure Active Directory → App registrations
- Click "New registration"
- Name: MyGarage
- Redirect URI: Copy from MyGarage UI after configuration
-
Configure Application:
- Copy Application (client) ID
- Copy Directory (tenant) ID
- Go to Certificates & secrets → Create new client secret
- Copy secret value (shown only once!)
-
MyGarage UI Configuration (Settings → System → OIDC):
-
Provider Name:
Azure AD -
Issuer URL:
https://login.microsoftonline.com/<tenant-id>/v2.0(replace<tenant-id>) - Client ID: Paste Application (client) ID
- Client Secret: Paste client secret value
-
Scopes:
openid profile email - Copy Redirect URI and add to Azure app registration
-
Provider Name:
When a user logs in via OIDC for the first time:
- MyGarage creates user account automatically
- Email from OIDC
emailclaim is used - First user becomes admin
- Subsequent users are standard users
Option 1: Manual (in MyGarage):
- Admin logs in
- Goes to Settings → Users
- Edits user role (Admin or Standard)
Option 2: OIDC Admin Group:
In Settings → System → OIDC, set Admin Group to a group name from your provider's groups claim. Users in that group get admin; everyone else is a standard user.
Cause: Redirect URI mismatch between OIDC provider and MyGarage
Fix: In Settings → System → OIDC, copy the exact Redirect URI MyGarage shows into your provider. Match protocol (https://), domain, and the /api/auth/oidc/callback path; watch trailing slashes.
Cause: Client secret incorrect or expired
Fix: Regenerate the secret in your provider, paste it into Settings → System → OIDC, and save.
Cause: OIDC provider not returning email in ID token
Fix:
- Ensure
emailscope is requested - Configure OIDC provider to include
emailclaim in ID token - Some providers require explicit consent for email scope
- Visit Settings → System
- Change Authentication Mode to Local
- Save settings (takes effect immediately)
- Visit web interface → Register first user
- Configure OIDC provider (create client - see examples above)
- Visit Settings → System
- Change Authentication Mode to OIDC
- Configure OIDC settings (provider, client ID, secret, etc.)
- Save settings (takes effect immediately)
- Visit web interface → Click "Login with SSO"
Migration Steps:
- Export data (backup)
- Switch to OIDC mode
- Have users login via OIDC (new accounts created)
- Admin reassigns vehicles to new OIDC users
- Delete orphaned local users
Recommendation: Plan migration carefully to avoid data loss.
- Default lifetime: 2 hours
- Sessions expire after this window; users must re-authenticate.
Users can manually logout:
- Click profile icon (top-right)
- "Logout"
- JWT cookie deleted
- Redirected to login page
If inactive for longer than JWT expiration:
- Session expires
- User redirected to login
- Must re-authenticate
- Auto-generated and stored at
/data/secret.key— no manual setup needed. -
Back up
/data/secret.key: losing it invalidates all existing login sessions. - Unique per instance. Only set
MYGARAGE_SECRET_KEYif you must share one secret across replicas.
- ✅ Always use HTTPS - JWT cookies require secure flag
- ✅ Use reverse proxy - Traefik, Nginx, Caddy with Let's Encrypt
- ❌ Never use HTTP in production - Session hijacking risk
- ✅ Enforce strong passwords - Min 12 characters, complexity
- ✅ Educate users - No password reuse, use password manager
- ✅ Require password changes - After security incidents
- ❌ Don't share accounts - Each user gets own account
Built-in rate limits (per IP):
- Auth endpoints (login, registration, password change/reset): 5 requests per minute
Exceeding the limit returns HTTP 429 until the window passes.
- Mode: Local authentication
- Users: 2-4 users (family members)
- Vehicles: Shared (all family members see all vehicles)
- Setup: Each family member has own account, all vehicles shared
- Mode: Local or OIDC authentication
- Users: 5-20 employees
- Vehicles: Assigned (drivers see only their vehicles)
- Setup: Admin assigns vehicles to each driver
- Mode: OIDC with Okta/Azure AD
- Users: 50+ employees
- Vehicles: Role-based access (garage admins see all, users see assigned)
- Setup: OIDC groups mapped to admin/user roles
- OIDC Configuration Issues - See Troubleshooting Guide
- Login Problems - See FAQ
- Security Questions - See SECURITY.md
- Community - GitHub Discussions
Next: Configure Database or set up Reverse Proxy.