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 |
Optional variables:
| Variable | Default | Description |
|---|---|---|
OIDC_SCOPES | openid profile email | Scopes requested from the IdP. Add groups (or your provider's equivalent) if you use groupβrole mapping. |
OIDC_AUTO_CREATE_USERS | true | Create a MeshMonitor user automatically on first OIDC login. |
OIDC_GROUPS_CLAIM | groups | ID-token claim containing the user's groups. Supports dot notation for nested claims (e.g. realm_access.roles for Keycloak). |
OIDC_ADMIN_GROUPS | (empty) | Comma-separated group names that grant MeshMonitor admin rights. See Group β Role Mapping. |
OIDC_ALLOWED_GROUPS | (empty) | Comma-separated group names allowed to log in at all. Empty = all OIDC users allowed. |
DISABLE_LOCAL_AUTH | false | Disable username/password login entirely (see Disabling Local Authentication). |
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/callbackGroup β Role Mapping β
By default, every OIDC user is created as a regular user, and the first OIDC login is bootstrapped to admin so the deployment isn't locked out; subsequent users must be promoted manually in the admin UI.
To map identity-provider groups to MeshMonitor roles automatically, set OIDC_ADMIN_GROUPS (and optionally OIDC_ALLOWED_GROUPS):
OIDC_SCOPES=openid profile email groups
OIDC_GROUPS_CLAIM=groups
OIDC_ADMIN_GROUPS=meshmonitor-admins
OIDC_ALLOWED_GROUPS=meshmonitor-users,meshmonitor-adminsBehaviour:
- Admin status follows the group on every login. When
OIDC_ADMIN_GROUPSis set, a user in one of those groups is made admin, and a user not in one is demoted (the IdP becomes authoritative β the first-login bootstrap no longer applies). WhenOIDC_ADMIN_GROUPSis empty, admin status is never changed by group membership and the bootstrap / manual-promotion behaviour is preserved. OIDC_ALLOWED_GROUPSgates who may log in at all. If set, a user in none of the listed groups is denied (admins always pass). Empty = all OIDC users allowed.- Group changes take effect on the user's next login (OIDC rides a session; unlike proxy auth, it is not re-evaluated on every request).
WARNING
If you set OIDC_ADMIN_GROUPS, make sure your own account is in that group, or keep a local admin as a break-glass login β otherwise you can demote yourself out of admin. The groups claim must be present in the ID token (configure a mapper in your IdP), not only at the userinfo endpoint.
Keycloak β
Add a Group Membership or Realm roles mapper to the client's dedicated scope and include it in the ID token. Realm roles arrive under a nested claim:
OIDC_GROUPS_CLAIM=realm_access.roles
OIDC_ADMIN_GROUPS=meshmonitor-adminAuthentik β
Groups are emitted in the groups claim by default (ensure the groups scope is requested). The defaults work as-is:
OIDC_SCOPES=openid profile email groups
OIDC_GROUPS_CLAIM=groups
OIDC_ADMIN_GROUPS=meshmonitor adminsTIP
If you front Keycloak/Authentik with a reverse proxy such as oauth2-proxy, you can instead use proxy auth (PROXY_AUTH_ENABLED=true with PROXY_AUTH_ADMIN_GROUPS / PROXY_AUTH_NORMAL_USER_GROUPS / PROXY_AUTH_JWT_GROUPS_CLAIM), which re-evaluates group membership on every request. See the reverse-proxy documentation.
Provider-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 β
To use OIDC (or proxy auth) exclusively, set:
DISABLE_LOCAL_AUTH=trueWhen enabled, username/password login is blocked entirely β the /api/auth/login endpoint returns 403 and the login UI hides the username/password form. There is no local API bypass.
DANGER
Because there is no local login bypass, make sure a working OIDC (or proxy) login exists before enabling this, or you can lock yourself out. The only safety net is the first-OIDC-login admin bootstrap (which does not apply if you have also set OIDC_ADMIN_GROUPS β in that case ensure your account is in an admin group). If you rely on a break-glass local admin, do not set DISABLE_LOCAL_AUTH=true.
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