OIDC Setup Guide
This guide provides step-by-step instructions for integrating OIDC (OpenID Connect) identity providers with the Inference API platform. The platform supports multiple OIDC providers including Microsoft Entra ID (Azure AD), Auth0, JumpCloud, Keycloak, and any standard OIDC-compliant provider.
Table of Contents
- Prerequisites
- Understanding OIDC Configuration
- General Setup Steps
- Provider-Specific Guides
- Platform Configuration
- Testing the Integration
- Troubleshooting
- Security Best Practices
Prerequisites
Before setting up OIDC integration, ensure you have:
- Access to your OIDC Provider: Administrative access to configure applications in your identity provider
- Platform Access: Access to configure tenant settings in the Inference API platform
- Network Access: The platform must be able to reach your OIDC provider's endpoints (authorization, token, userinfo, JWKS)
- HTTPS: All communication must use HTTPS (required for OIDC security)
- Callback URL: A publicly accessible callback URL for your platform (e.g.,
https://api.yourplatform.com/v1/auth/oidc/callback)
Understanding OIDC Configuration
The Inference API platform requires the following OIDC configuration parameters for each tenant:
| Parameter | Description | Example |
|---|---|---|
| OIDCIssuer | The OIDC provider's issuer URL (well-known configuration endpoint) | https://login.microsoftonline.com/{tenant-id}/v2.0 |
| OIDCClientID | The OAuth2 client ID registered with your OIDC provider | 00001111-aaaa-2222-bbbb-3333cccc4444 |
| OIDCClientSecret | The OAuth2 client secret (keep this secure) | your-secret-value |
| OIDCRedirectURL | The callback URL where the provider redirects after authentication | https://api.yourplatform.com/v1/auth/oidc/callback |
| OIDCScopes | Space-separated list of scopes to request | openid profile email |
| FrontendURL | Your frontend application URL for token delivery | https://app.yourplatform.com |
Finding Your OIDC Issuer URL
The issuer URL is typically found at your provider's well-known OpenID configuration endpoint:
{provider_base_url}/.well-known/openid-configuration
For example:
- Microsoft Entra:
https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration - Auth0:
https://{your-domain}.auth0.com/.well-known/openid-configuration - JumpCloud:
https://sso.jumpcloud.com/sso/.well-known/openid-configuration - Keycloak:
https://keycloak.example.com/realms/{realm}/.well-known/openid-configuration
The issuer URL is usually the base URL without the .well-known/openid-configuration path. For example, if the well-known endpoint is https://login.microsoftonline.com/abc123/v2.0/.well-known/openid-configuration, the issuer URL would be https://login.microsoftonline.com/abc123/v2.0.
General Setup Steps
Step 1: Register Application in OIDC Provider
- Log in to your OIDC provider's administration console
- Navigate to Application Registration or App Registration
- Create a new application or select an existing one
- Configure the application type (typically "Web Application" or "Confidential Client")
Step 2: Configure Redirect URI
In your OIDC provider, add the callback URL as an allowed redirect URI:
https://api.yourplatform.com/v1/auth/oidc/callback
Important: The redirect URI must:
- Use HTTPS (HTTP is not allowed for security)
- Match exactly (including trailing slashes) with the URL configured in the platform
- Be publicly accessible (not behind a firewall that blocks the OIDC provider)
Step 3: Enable Required Scopes
Ensure your OIDC provider is configured to issue ID tokens and supports the following scopes:
openid(required)profile(recommended)email(recommended)
Step 4: Configure Response Type
The platform uses the Authorization Code flow with PKCE. Ensure your OIDC provider supports:
- Authorization Code grant type
- PKCE (Proof Key for Code Exchange) with S256 method
Step 5: Obtain Credentials
After registering the application, obtain:
- Client ID: Usually displayed immediately after registration
- Client Secret: May need to be generated or revealed (save this securely)
- Issuer URL: Found in the provider's well-known configuration document
Step 6: Configure Platform
Add the OIDC configuration to your tenant configuration in the platform (see Platform Configuration section below).
Provider-Specific Guides
Microsoft Entra ID (Azure AD)
Microsoft Entra ID (formerly Azure AD) is Microsoft's cloud-based identity and access management service. Reference: Microsoft Entra OIDC Documentation
Step 1: Register Application in Azure Portal
- Sign in to the Azure Portal
- Navigate to Microsoft Entra ID > App registrations
- Click New registration
- Enter application details:
- Name: Your application name (e.g., "Inference API Integration")
- Supported account types: Select based on your needs:
- Accounts in this organizational directory only: Single tenant
- Accounts in any organizational directory: Multi-tenant
- Accounts in any organizational directory and personal Microsoft accounts: Multi-tenant with personal accounts
- Redirect URI:
- Platform: Web
- URI:
https://api.yourplatform.com/v1/auth/oidc/callback
- Click Register
Step 2: Configure Authentication
- In your app registration, go to Authentication
- Under Platform configurations, ensure Web platform is added
- Under Implicit grant and hybrid flows, you do NOT need to enable "ID tokens" (the platform uses authorization code flow, not implicit flow)
- Under Advanced settings, ensure Allow public client flows is set to No (unless you have specific requirements)
Step 3: Create Client Secret
- Go to Certificates & secrets
- Click New client secret
- Enter a description (e.g., "OIDC Integration Secret")
- Select expiration period (recommended: 24 months)
- Click Add
- Important: Copy the secret value immediately (it will not be shown again)
Step 4: Configure API Permissions (Optional)
- Go to API permissions
- The default permissions (
openid,profile,email,User.Read) are usually sufficient - If you need additional Microsoft Graph permissions, add them here
Step 5: Get Configuration Values
-
Client ID: Found on the Overview page (Application (client) ID)
-
Client Secret: The value you copied in Step 3
-
Issuer URL: Construct based on your tenant:
- Single tenant:
https://login.microsoftonline.com/{tenant-id}/v2.0 - Multi-tenant (organizations):
https://login.microsoftonline.com/organizations/v2.0 - Multi-tenant (common):
https://login.microsoftonline.com/common/v2.0
To find your tenant ID:
- Go to Overview page
- Copy the Directory (tenant) ID
- Single tenant:
-
Well-Known Configuration: Verify by visiting:
https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration
Step 6: Platform Configuration
Use these values in your platform configuration:
{
"oidc_issuer": "https://login.microsoftonline.com/{tenant-id}/v2.0",
"oidc_client_id": "00001111-aaaa-2222-bbbb-3333cccc4444",
"oidc_client_secret": "your-client-secret-value",
"oidc_redirect_url": "https://api.yourplatform.com/v1/auth/oidc/callback",
"oidc_scopes": "openid profile email"
}
Microsoft-Specific Notes:
- The platform automatically discovers endpoints from the well-known configuration
- Microsoft Entra supports PKCE by default
- ID tokens are issued automatically when using authorization code flow with
openidscope - The
subclaim in ID tokens is a pairwise identifier (unique per application)
Generic OIDC Provider
For any standard OIDC-compliant provider (Keycloak, Okta, Google Workspace, etc.), follow these general steps:
Step 1: Locate Provider Documentation
Consult your provider's documentation for:
- Application registration process
- OAuth2/OIDC configuration
- Well-known configuration endpoint location
Step 2: Register Application
- Create a new OAuth2/OIDC application in your provider
- Application type: Confidential Client or Web Application
- Grant type: Authorization Code
- Enable PKCE if supported (recommended)
Step 3: Configure Redirect URI
Add the callback URL:
https://api.yourplatform.com/v1/auth/oidc/callback
Step 4: Get Configuration Values
- Client ID: From application registration
- Client Secret: From application registration (generate if needed)
- Issuer URL: Found in well-known configuration:
The issuer URL is typically the base URL without the path
{provider_base_url}/.well-known/openid-configuration
Step 5: Verify Well-Known Configuration
Visit the well-known endpoint and verify it returns valid JSON with:
issuer: The issuer URLauthorization_endpoint: Authorization endpoint URLtoken_endpoint: Token endpoint URLjwks_uri: JSON Web Key Set endpointuserinfo_endpoint: UserInfo endpoint (optional)
Step 6: Platform Configuration
Use these values in your platform configuration:
{
"oidc_issuer": "https://your-provider.com",
"oidc_client_id": "your-client-id",
"oidc_client_secret": "your-client-secret",
"oidc_redirect_url": "https://api.yourplatform.com/v1/auth/oidc/callback",
"oidc_scopes": "openid profile email"
}
Keycloak Example:
{
"oidc_issuer": "https://keycloak.example.com/realms/your-realm",
"oidc_client_id": "your-keycloak-client-id",
"oidc_client_secret": "your-keycloak-client-secret",
"oidc_redirect_url": "https://api.yourplatform.com/v1/auth/oidc/callback",
"oidc_scopes": "openid profile email"
}
Platform Configuration
After obtaining the OIDC configuration values from your provider, configure them in the Inference API platform.
Configuration Format
The OIDC configuration is part of the tenant configuration. Add the following fields to your tenant configuration:
{
"tenant_id": "your-tenant-id",
"name": "Your Tenant Name",
"mongo_uri": "mongodb://...",
"mongo_database": "your-database",
"redis_addr": "localhost:6379",
"redis_db": 0,
"frontend_url": "https://app.yourplatform.com",
"oidc_issuer": "https://your-oidc-provider.com",
"oidc_client_id": "your-client-id",
"oidc_client_secret": "your-client-secret",
"oidc_redirect_url": "https://api.yourplatform.com/v1/auth/oidc/callback",
"oidc_scopes": "openid profile email"
}
Configuration Validation
The platform validates OIDC configuration as follows:
-
If
oidc_issueris provided, the following are required:oidc_client_id(required)oidc_client_secret(required)oidc_redirect_url(required)oidc_scopes(optional, defaults to"openid profile email"if not provided)
-
If
oidc_issueris empty, OIDC is disabled for the tenant (other OIDC fields are ignored)
Environment Variable Configuration
If using environment variables for configuration, the OIDC fields map as follows:
TENANT_OIDC_ISSUER=https://your-oidc-provider.com
TENANT_OIDC_CLIENT_ID=your-client-id
TENANT_OIDC_CLIENT_SECRET=your-client-secret
TENANT_OIDC_REDIRECT_URL=https://api.yourplatform.com/v1/auth/oidc/callback
TENANT_OIDC_SCOPES=openid profile email
Configuration Updates
After updating OIDC configuration:
-
Restart the service: The platform caches OIDC provider configurations in memory. Restart the service to load new configurations.
-
Clear caches: If provider caching causes issues, restart the service to clear the cache.
-
Verify connectivity: Ensure the platform can reach your OIDC provider's endpoints (authorization, token, JWKS).
Testing the Integration
Step 1: Verify Configuration
-
Check well-known endpoint: Visit your provider's well-known configuration endpoint:
{issuer_url}/.well-known/openid-configurationVerify it returns valid JSON.
-
Test provider discovery: The platform automatically discovers endpoints from the well-known configuration. Check logs for any discovery errors.
Step 2: Test Login Flow
-
Initiate login: Send a POST request to initiate OIDC login:
curl -X POST https://api.yourplatform.com/v1/auth/oidc/login \
-H "Content-Type: application/json" \
-d '{"tenant_id": "your-tenant-id"}' -
Verify response: You should receive an
auth_urlin the response:{
"auth_url": "https://your-oidc-provider.com/authorize?..."
} -
Test authorization: Open the
auth_urlin a browser and verify:- You are redirected to your OIDC provider
- The login page appears correctly
- You can authenticate with valid credentials
-
Test callback: After authentication:
- You should be redirected to the callback URL
- The callback should process successfully
- You should be redirected to your frontend with a token in the URL fragment
Step 3: Verify Token
- Extract token: Extract the token from the URL fragment after successful authentication
- Test API request: Use the token in an API request:
curl -X GET https://api.yourplatform.com/v1/some-endpoint \
-H "Authorization: Bearer {token}" - Verify user context: Check that the request context includes:
- Correct user ID (from OIDC
subclaim) - Correct tenant ID
IsSSO: trueflag- User email and name (if available)
- Correct user ID (from OIDC
Step 4: Test Error Scenarios
Test common error scenarios:
- Invalid credentials: Attempt login with invalid credentials (should fail at provider)
- Expired state: Wait for state to expire (10 minutes) and attempt callback (should fail)
- Invalid redirect URI: Temporarily change redirect URI in provider (should fail)
- Missing scopes: Remove required scopes (should fail or return incomplete token)