SSO Setup (OpenID Connect) β
MeshMonitor supports Single Sign-On (SSO) via OpenID Connect (OIDC), allowing you to integrate with enterprise identity providers like Auth0, Okta, Keycloak, Azure AD, and more.
Overview β
OIDC integration provides:
- Centralized Authentication: Use your existing identity provider
- Auto-User Creation: Automatically create users on first login
- Authorization Code Flow with PKCE: Secure authentication flow
- ID Token Verification: Validates tokens from the identity provider
- Multiple Providers: Support for any OIDC-compliant provider
Prerequisites β
Before configuring SSO, you need:
- An OIDC-compliant identity provider (IdP)
- A registered OAuth/OIDC application/client in your IdP
- The following information from your IdP:
- Issuer URL
- Client ID
- Client Secret
- Redirect URI (callback URL)
Configuration β
Environment Variables β
Configure OIDC using these environment variables:
| Variable | Description | Required |
|---|---|---|
OIDC_ISSUER | Your identity provider's issuer URL | Yes |
OIDC_CLIENT_ID | OAuth client ID from your IdP | Yes |
OIDC_CLIENT_SECRET | OAuth client secret from your IdP | Yes |
OIDC_REDIRECT_URI | Callback URL for OIDC authentication | Yes |
Example Configuration β
Docker Compose β
services:
meshmonitor:
image: meshmonitor:latest
environment:
- MESHTASTIC_NODE_IP=192.168.1.100
- OIDC_ISSUER=https://your-domain.auth0.com
- OIDC_CLIENT_ID=your_client_id_here
- OIDC_CLIENT_SECRET=your_client_secret_here
- OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callback
ports:
- "8080:8080"Environment File (.env) β
MESHTASTIC_NODE_IP=192.168.1.100
OIDC_ISSUER=https://your-domain.auth0.com
OIDC_CLIENT_ID=your_client_id_here
OIDC_CLIENT_SECRET=your_client_secret_here
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackProvider-Specific Setup β
Auth0 β
- Log in to your Auth0 dashboard
- Create a new application:
- Type: "Regular Web Application"
- Name: "MeshMonitor"
- Configure the application:
- Allowed Callback URLs:
https://meshmonitor.example.com/api/auth/oidc/callback - Allowed Logout URLs:
https://meshmonitor.example.com
- Allowed Callback URLs:
- Get your credentials from the "Settings" tab:
- Domain:
your-domain.auth0.com - Client ID: Copy the Client ID
- Client Secret: Copy the Client Secret
- Domain:
Environment Variables:
OIDC_ISSUER=https://your-domain.auth0.com
OIDC_CLIENT_ID=<your-client-id>
OIDC_CLIENT_SECRET=<your-client-secret>
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackKeycloak β
- Log in to your Keycloak admin console
- Create a new client:
- Client ID:
meshmonitor - Client Protocol:
openid-connect - Access Type:
confidential
- Client ID:
- Configure the client:
- Valid Redirect URIs:
https://meshmonitor.example.com/api/auth/oidc/callback - Web Origins:
https://meshmonitor.example.com
- Valid Redirect URIs:
- Get your credentials from the "Credentials" tab
Environment Variables:
OIDC_ISSUER=https://keycloak.example.com/realms/your-realm
OIDC_CLIENT_ID=meshmonitor
OIDC_CLIENT_SECRET=<your-client-secret>
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackAzure AD (Entra ID) β
- Log in to Azure Portal
- Navigate to Azure Active Directory β App registrations
- Create a new registration:
- Name: "MeshMonitor"
- Supported account types: Choose appropriate option
- Redirect URI:
https://meshmonitor.example.com/api/auth/oidc/callback
- Create a client secret in "Certificates & secrets"
- Note your Tenant ID and Application (client) ID
Environment Variables:
OIDC_ISSUER=https://login.microsoftonline.com/<tenant-id>/v2.0
OIDC_CLIENT_ID=<application-id>
OIDC_CLIENT_SECRET=<client-secret>
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackOkta β
- Log in to your Okta admin dashboard
- Create a new Web application:
- Application type: "Web"
- Grant type: "Authorization Code"
- Configure the application:
- Sign-in redirect URIs:
https://meshmonitor.example.com/api/auth/oidc/callback - Sign-out redirect URIs:
https://meshmonitor.example.com
- Sign-in redirect URIs:
- Copy your Client ID and Client Secret
Environment Variables:
OIDC_ISSUER=https://your-domain.okta.com
OIDC_CLIENT_ID=<your-client-id>
OIDC_CLIENT_SECRET=<your-client-secret>
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackGoogle OAuth β
- Go to Google Cloud Console
- Create a new project or select existing
- Enable the Google+ API
- Create OAuth 2.0 credentials:
- Application type: "Web application"
- Authorized redirect URIs:
https://meshmonitor.example.com/api/auth/oidc/callback
- Copy your Client ID and Client Secret
Environment Variables:
OIDC_ISSUER=https://accounts.google.com
OIDC_CLIENT_ID=<your-client-id>.apps.googleusercontent.com
OIDC_CLIENT_SECRET=<your-client-secret>
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackAuthentication Flow β
When OIDC is configured, users see a "Sign in with SSO" button on the login page.
Login Process β
- User clicks "Sign in with SSO"
- User is redirected to the identity provider
- User authenticates with their IdP credentials
- IdP redirects back to MeshMonitor with an authorization code
- MeshMonitor exchanges the code for an ID token
- User account is created/updated automatically
- User is logged in and redirected to the dashboard
User Attributes β
MeshMonitor extracts these attributes from the ID token:
- Username: From
preferred_usernameoremailclaim - Email: From
emailclaim - Display Name: From
nameclaim - OIDC Subject: From
subclaim (used for linking accounts)
User Management β
Auto-User Creation β
When a user logs in via OIDC for the first time:
- A new user account is automatically created
- The user is marked as using OIDC authentication
- The OIDC subject (
subclaim) is stored for future logins
Admin Privileges β
The first OIDC user to log in is automatically promoted to admin. This bootstrap exists so a deployment isn't locked out when local authentication is disabled β without it there would be no way to administer the instance via SSO. The first OIDC user receives full admin rights and permissions on all resources.
All subsequent OIDC users are created as regular (non-admin) accounts. SSO login does not elevate their privileges automatically; admin access must be granted explicitly by an existing admin.
WARNING
"First OIDC user" means the first user whose authentication method is OIDC β it is independent of any local accounts (such as the built-in admin account) that may already exist. If you do not want the first SSO sign-in to gain admin rights, create and configure your admins ahead of time, or keep local authentication enabled and manage permissions from a local admin account.
To grant admin to an additional OIDC user:
- Log in as an existing admin (e.g. the built-in
adminlocal account) - Navigate to Settings β Users
- Select the user and grant admin / per-source permissions as needed
TIP
Keep at least one local admin account available as a break-glass login in case your OIDC provider is unreachable.
Disabling Local Authentication β
If you want to use OIDC exclusively, you can disable local authentication and registration in the UI. However, local authentication will still be available via API for administrative purposes.
Troubleshooting β
Redirect URI Mismatch β
Error: "redirect_uri_mismatch" or similar
Solution: Ensure the OIDC_REDIRECT_URI exactly matches the callback URL configured in your identity provider, including:
- Protocol (http vs https)
- Port number (if not standard)
- Path (
/api/auth/oidc/callback)
Invalid Issuer β
Error: "Discovery failed" or "Invalid issuer"
Solution:
- Verify the
OIDC_ISSUERURL is correct - Ensure the issuer has a publicly accessible
.well-known/openid-configurationendpoint - Test:
curl https://your-issuer.com/.well-known/openid-configuration
Token Validation Failures β
Error: "ID token validation failed"
Solution:
- Check that your client secret is correct
- Verify your identity provider's token signing algorithm is supported (RS256, HS256)
- Ensure system time is synchronized (NTP)
Users Not Being Created β
If users can authenticate but don't appear in MeshMonitor:
- Check the backend logs for errors
- Verify the ID token contains required claims (
sub,emailorpreferred_username) - Check database permissions
Security Best Practices β
Use HTTPS β
Always use HTTPS in production when using OIDC:
OIDC_REDIRECT_URI=https://meshmonitor.example.com/api/auth/oidc/callbackProtect Client Secret β
Never commit your client secret to version control:
- Use environment variables
- Use secret management tools (Vault, AWS Secrets Manager, etc.)
- Rotate secrets regularly
Restrict Redirect URIs β
In your identity provider, only whitelist the exact redirect URI you need. Do not use wildcards.
Monitor Authentication Logs β
Regularly review authentication logs for suspicious activity:
# Docker
docker logs meshmonitor | grep "auth"
# Kubernetes
kubectl logs -f deployment/meshmonitor | grep "auth"Combining OIDC with Local Auth β
You can use both OIDC and local authentication simultaneously:
- OIDC for regular users
- Local auth for admin/service accounts
This provides a fallback if your identity provider becomes unavailable.
Next Steps β
- Configure a reverse proxy for HTTPS
- Set up production deployment with proper monitoring
- Learn about HTTP vs HTTPS considerations