Skip to main content

OIDC / SSO Setup

O.D.I.N. supports Single Sign-On via OpenID Connect (OIDC). When SSO is configured, users can log in with their existing identity provider account. New users can be auto-provisioned on first login.

Enterprise License Required

OIDC / SSO requires an Enterprise license.


Supported Providers

ProviderDiscovery URL FormatNotes
Keycloakhttps://keycloak.example.com/realms/{realm}Self-hosted, most common for on-premise installs
Authentikhttps://auth.example.com/application/o/{slug}/Self-hosted, excellent for home labs
Google Workspacehttps://accounts.google.comRequires Google Cloud project + OAuth consent screen
Microsoft Entra IDhttps://login.microsoftonline.com/{tenant-id}/v2.0Formerly Azure AD; supported since v1.3.67
Generic OIDCAny compliant discovery URLWorks with any provider exposing a .well-known/openid-configuration endpoint

General Setup Steps

Step 1: Create an Application in Your IdP

  1. In your identity provider, create a new OAuth 2.0 / OIDC application
  2. Set the Redirect URI to: https://your-odin-host/api/auth/oidc/callback
  3. Note the Client ID, Client Secret, and Discovery URL
  4. Set the scopes: openid profile email

Step 2: Configure O.D.I.N.

Navigate to Settings → Access → SSO / OIDC (admin only).

FieldDescription
Display NameLabel shown on the SSO button on the login page (e.g., "Log in with Keycloak")
Client IDFrom your IdP application
Client SecretFrom your IdP application (encrypted at rest)
Discovery URLThe IdP's OIDC discovery endpoint
ScopesSpace-separated scopes (default: openid profile email)
Auto-Create UsersIf enabled, users logging in for the first time are auto-provisioned
Default RoleRole assigned to auto-created users (viewer, operator, admin)
EnabledToggle SSO on/off

Step 3: Test the Login Flow

  1. Open a private/incognito browser window
  2. Go to the O.D.I.N. login page
  3. Click the SSO button (displayed with the Display Name you set)
  4. Complete authentication in your IdP
  5. Verify you are redirected back and logged in

O.D.I.N. Configuration Fields Reference

The OIDC configuration is stored in the oidc_config table:

DB ColumnFieldDescription
display_nameDisplay NameSSO button label on login page
client_idClient IDOAuth client identifier
client_secret_encryptedClient SecretFernet-encrypted client secret
discovery_urlDiscovery URLOIDC well-known configuration URL
scopesScopesOAuth scopes requested
auto_create_usersAuto-Create UsersProvision new users on first login
default_roleDefault RoleRole for auto-created users
is_enabledEnabledToggle SSO availability

Reverse Proxy and Redirect URI

Set OIDC_REDIRECT_URI When Behind a Reverse Proxy

When O.D.I.N. is accessed through a reverse proxy (nginx, Caddy, Traefik), the auto-detected redirect URI may resolve to an internal address (e.g., http://172.17.0.1/api/auth/oidc/callback) instead of your public domain. This causes the IdP's callback to fail.

Set the OIDC_REDIRECT_URI environment variable to pin the redirect URI explicitly:

# docker-compose.yml
environment:
OIDC_REDIRECT_URI: https://odin.example.com/api/auth/oidc/callback

This prevents Host-header injection and ensures the callback URL matches what you registered in the IdP. (Introduced in v1.3.67)


Keycloak Step-by-Step

  1. In Keycloak admin console, go to your realm → Clients → Create client
  2. Client type: OpenID Connect
  3. Client ID: odin (or any name)
  4. Enable Client authentication (confidential access type)
  5. Set Valid redirect URIs: https://your-odin-host/api/auth/oidc/callback
  6. Note the Client secret from the Credentials tab
  7. Discovery URL: https://keycloak.example.com/realms/your-realm
  8. Enter all values in O.D.I.N.'s OIDC settings

Authentik Step-by-Step

  1. In Authentik, go to Applications → Providers → Create → OAuth2/OpenID Provider
  2. Name: odin
  3. Authorization flow: your default authorization flow
  4. Redirect URIs: https://your-odin-host/api/auth/oidc/callback
  5. Copy the Client ID and Client Secret from the provider detail
  6. Discovery URL: https://auth.example.com/application/o/odin/
  7. Create an Application pointing to this provider
  8. Enter values in O.D.I.N.'s OIDC settings

Role Mapping

OIDC users are assigned the Default Role on first login. Admins can change a user's role manually after initial provisioning under Settings → Access → Users.

There is no claim-based role mapping — roles are assigned within O.D.I.N. after the user is provisioned.


See Also