Authentication & OIDC
Eneo supports OpenID Connect (OIDC) for single sign-on integration with your organization’s identity provider. This guide covers configuration for popular OIDC providers.
Overview
OIDC authentication in Eneo provides:
- Single sign-on (SSO) for your organization
- Centralized user management
- Multi-factor authentication (when supported by your provider)
- Automatic user provisioning
Configuration
OIDC settings are configured through environment variables in your backend service.
Required Environment Variables
# Enable OIDC authentication
OIDC_ENABLED=true
# Your OIDC provider's discovery URL
OIDC_DISCOVERY_URL=https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration
# Your application's client ID from the OIDC provider
OIDC_CLIENT_ID=your-client-id
# Your application's client secret
OIDC_CLIENT_SECRET=your-client-secret
# Callback URL where users return after authentication
OIDC_REDIRECT_URI=https://your-domain.com/api/auth/callbackAzure Entra ID (formerly Azure AD)
Azure Entra ID is Microsoft’s cloud-based identity and access management service.
Step 1: Register an Application
- Go to Azure Portal
- Navigate to Azure Active Directory → App registrations
- Click New registration
- Configure your application:
- Name: Eneo
- Supported account types: Accounts in this organizational directory only
- Redirect URI: Web →
https://your-domain.com/api/auth/callback
- Click Register
Step 2: Create a Client Secret
- In your app registration, go to Certificates & secrets
- Click New client secret
- Add a description and expiration period
- Copy the secret value (you won’t be able to see it again)
Step 3: Configure API Permissions
- Go to API permissions
- Click Add a permission → Microsoft Graph
- Select Delegated permissions
- Add these permissions:
openidprofileemailUser.Read
- Click Grant admin consent (requires admin rights)
Step 4: Configure Eneo
Add these variables to your env_backend.env:
OIDC_ENABLED=true
OIDC_DISCOVERY_URL=https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration
OIDC_CLIENT_ID={your-application-id}
OIDC_CLIENT_SECRET={your-client-secret}
OIDC_REDIRECT_URI=https://your-domain.com/api/auth/callbackReplace:
{tenant-id}: Your Azure AD tenant ID (found in Azure AD overview){your-application-id}: Your app’s Application (client) ID{your-client-secret}: The client secret you createdyour-domain.com: Your actual domain
Step 5: Restart Eneo
docker compose restart backendKeycloak
Keycloak is an open-source identity and access management solution.
Step 1: Create a Client
- Log in to your Keycloak admin console
- Select your realm
- Go to Clients → Create client
- Configure the client:
- Client type: OpenID Connect
- Client ID: eneo
- Click Next
Step 2: Configure Client Settings
- Client authentication: ON (for confidential access type)
- Standard flow: Enabled (Authorization Code Flow)
- Direct access grants: Disabled
- Valid redirect URIs:
https://your-domain.com/api/auth/callback - Web origins:
https://your-domain.com - Click Save
Step 3: Get Client Secret
- Go to the Credentials tab
- Copy the Client secret
Step 4: Configure Eneo
Add these variables to your env_backend.env:
OIDC_ENABLED=true
OIDC_DISCOVERY_URL=https://your-keycloak.com/realms/{realm-name}/.well-known/openid-configuration
OIDC_CLIENT_ID=eneo
OIDC_CLIENT_SECRET={your-client-secret}
OIDC_REDIRECT_URI=https://your-domain.com/api/auth/callbackReplace:
your-keycloak.com: Your Keycloak server URL{realm-name}: Your realm name{your-client-secret}: The client secret from step 3
Step 5: Restart Eneo
docker compose restart backendAuth0
Auth0 is a flexible identity platform.
Step 1: Create an Application
- Go to Auth0 Dashboard
- Navigate to Applications → Applications
- Click Create Application
- Configure:
- Name: Eneo
- Application Type: Regular Web Applications
- Click Create
Step 2: Configure Application Settings
- In the application settings:
- Allowed Callback URLs:
https://your-domain.com/api/auth/callback - Allowed Logout URLs:
https://your-domain.com - Allowed Web Origins:
https://your-domain.com
- Allowed Callback URLs:
- Click Save Changes
Step 3: Get Credentials
From your application’s settings, note:
- Domain (e.g.,
your-tenant.auth0.com) - Client ID
- Client Secret
Step 4: Configure Eneo
Add these variables to your env_backend.env:
OIDC_ENABLED=true
OIDC_DISCOVERY_URL=https://your-tenant.auth0.com/.well-known/openid-configuration
OIDC_CLIENT_ID={your-client-id}
OIDC_CLIENT_SECRET={your-client-secret}
OIDC_REDIRECT_URI=https://your-domain.com/api/auth/callbackReplace:
your-tenant.auth0.com: Your Auth0 domain{your-client-id}: Your application’s Client ID{your-client-secret}: Your application’s Client Secret
Step 5: Restart Eneo
docker compose restart backendGeneric OIDC Provider
If your provider isn’t listed above, you can use these general steps:
Requirements
Your OIDC provider must support:
- OpenID Connect Discovery (
.well-known/openid-configuration) - Authorization Code Flow
- Standard OIDC scopes:
openid,profile,email
Configuration Steps
-
Register your application with your OIDC provider
- Set redirect URI to:
https://your-domain.com/api/auth/callback - Request scopes:
openid,profile,email
- Set redirect URI to:
-
Get your credentials:
- Client ID
- Client Secret
- Discovery URL (usually ends with
/.well-known/openid-configuration)
-
Configure Eneo:
OIDC_ENABLED=true OIDC_DISCOVERY_URL={your-discovery-url} OIDC_CLIENT_ID={your-client-id} OIDC_CLIENT_SECRET={your-client-secret} OIDC_REDIRECT_URI=https://your-domain.com/api/auth/callback -
Restart the backend:
docker compose restart backend
Testing Your Configuration
After configuration, test the authentication flow:
- Navigate to your Eneo instance:
https://your-domain.com - You should see a Sign in with SSO button
- Click the button and verify you’re redirected to your identity provider
- Complete the login process
- Verify you’re redirected back to Eneo and logged in
Troubleshooting
Users Can’t Sign In
Check redirect URI configuration:
- Ensure the redirect URI matches exactly in both your OIDC provider and Eneo configuration
- Include protocol (
https://) and path (/api/auth/callback)
Verify discovery URL:
curl https://your-oidc-provider/.well-known/openid-configurationThis should return a JSON document with OIDC endpoints.
Invalid Client Error
Check client credentials:
- Verify
OIDC_CLIENT_IDmatches your provider’s client ID - Ensure
OIDC_CLIENT_SECRETis correct and hasn’t expired - Some providers require secrets to be regenerated periodically
Redirect URI Mismatch
Common causes:
- HTTP vs HTTPS mismatch
- Trailing slash differences
- Port numbers
- Subdomain differences
Ensure exact match:
- Provider:
https://eneo.example.com/api/auth/callback - Eneo:
https://eneo.example.com/api/auth/callback
Permission Errors
For Azure Entra ID:
- Ensure admin consent is granted for required permissions
- Check the user has access to the application
For Keycloak:
- Verify the user exists in the correct realm
- Check client scope mappings
Check Logs
View backend logs for detailed error messages:
docker compose logs backendSecurity Best Practices
- Use HTTPS: Always use HTTPS in production for redirect URIs
- Rotate Secrets: Regularly rotate client secrets
- Limit Scopes: Only request the scopes you need
- Monitor Access: Review authentication logs regularly
- Keep Updated: Keep your OIDC provider configuration current
Need Help?
- Check the troubleshooting guide
- Visit GitHub Issues
- Contact us at digitalisering@sundsvall.se (public sector organizations)