Self-hosted availability: OIDC SSO is available on self-hosted
installations without an Enterprise license. Free self-hosted instances are
limited to 2 users total across the whole instance, regardless of whether
users are created by registration, invitations, or OIDC provisioning. An
Enterprise license is required to add more users.
OpnForm displays the exact callback URL for each connection. Copy that URL
into your IdP’s allowed redirect URIs; it must match exactly.
Features
- Domain-Based Routing: Automatically routes users to the correct OIDC provider based on their email domain
- Group-to-Role Mapping: Automatically assign workspace roles based on IdP groups
- Custom Field Mappings: Support for custom claim field names from your IdP
- Automatic User Provisioning: Creates users automatically on first login
- Force Login Mode: Optionally require all users to authenticate via OIDC
Prerequisites
Before setting up OIDC SSO, ensure you have:- An OIDC-compliant identity provider (IdP) configured
- OAuth client credentials (Client ID and Client Secret) from your IdP
- Admin access to the workspace where you want to configure SSO
- The issuer URL from your IdP (typically found in the
.well-known/openid-configurationendpoint)
Self-hosted instance setup
Before creating an OIDC connection, make sure that OpnForm is configured with its real public URL. This is a deployment prerequisite: it determines the callback URL shown in the OIDC connection form. For the standard Docker deployment where OpnForm is available athttps://forms.example.com, the person who manages the deployment must set:
If deployment and OIDC configuration are handled by different people, share
this checklist with the person who manages the instance. See Public
instance URL for
the full reference and Docker Deployment
for the Docker steps.
On self-hosted Community instances, OIDC can provision users until the
instance reaches the free 2-user limit. Existing linked users can continue
signing in with OIDC. Activate a self-hosted Enterprise license to add more
than 2 users.
Setup Steps
1
Get OIDC Provider Information
From your identity provider, collect the following information:
- Issuer URL: The base URL of your IdP (e.g.,
https://idp.company.com) - Client ID: OAuth client identifier
- Client Secret: OAuth client secret
- Email Domain: The domain you want to use for routing (e.g.,
company.com)
2
Create OIDC Connection
- Navigate to your workspace settings
- Go to the SSO section
- Click Add Connection
-
Fill in the connection details:
- Name: Display name for this connection (e.g., “Company SSO”)
- Slug: Unique identifier used in URLs (e.g.,
company-sso) - Email Domain: Domain for routing users (e.g.,
company.com) - Issuer URL: Your IdP’s issuer URL
- Client ID: OAuth client ID from your IdP
- Client Secret: OAuth client secret from your IdP
The redirect URI will be displayed automatically. Copy this URL and add it to your IdP’s allowed redirect URIs.
3
Configure Redirect URI in IdP
- Copy the redirect URI shown in the connection form
- In your IdP’s application settings, add this redirect URI to the allowed redirect URIs list
- Save the configuration in your IdP
4
Configure Group-to-Role Mapping (Optional)
If your IdP provides group information in the ID token, you can map
groups to workspace roles:
- In the connection settings, expand Role Mappings
- Click Add Mapping
- Enter the exact value from the token’s
groups(orgroup) claim - Select the corresponding workspace role (owner, admin, editor, or member)
- Repeat for each group you want to map
If a user belongs to multiple groups, the highest privilege role will be assigned. Role priority: owner > admin > editor > member.
OpnForm reads only the
groups or group claim. Configure your IdP to
include one of these claims in the ID token. A custom claim name or
a claim named roles is not used for role mapping.5
Configure Field Mappings (Optional)
If your IdP uses non-standard claim names for email or name:
- In the connection settings, expand Field Mappings
- Enter the custom claim field name for email (if different from
email) - Enter the custom claim field name for name (if different from
name) - Save the connection
If field mappings are not configured, OpnForm will use standard OIDC claim names (
email, name, etc.).6
Enable and Test
- Ensure the connection is Enabled
- Save the connection
- Test the login flow:
- Navigate to the login page
- Enter an email address matching your configured domain
- You should be redirected to your IdP for authentication
- After successful authentication, you’ll be redirected back and logged in
If everything is configured correctly, users with emails from your domain will automatically be routed to your IdP for authentication.
Force Login Mode
Force Login Mode requires all users to authenticate via OIDC, disabling password-based login.Configuration
Set theOIDC_FORCE_LOGIN environment variable to true in your backend .env file:
Behavior
When enabled:- Password-based login attempts are blocked
- Users attempting password login receive: “Password-based login is disabled. Please use OIDC authentication.”
- The login form automatically redirects users to their OIDC provider based on email domain
- If
force_loginis enabled but no OIDC connections exist, password login remains available as a fallback
Use Cases
- Organizations requiring all users to authenticate via corporate SSO
- Security policies mandating centralized identity management
- Compliance requirements for authentication methods
Updating a connection or changing the instance URL
You can edit an existing OIDC connection without deleting it.- Leave Client Secret empty to retain the current secret. Enter a value only when rotating or replacing it.
- After changing the public URL of a self-hosted instance, update both the
backend
APP_URLandFRONT_URL, plus the frontendNUXT_PUBLIC_APP_URLandNUXT_PUBLIC_API_BASE. Recreate the relevant containers so the new environment values are loaded. - Edit the connection, click Use current app URL below its redirect URI, then save. Copy the refreshed URL into your IdP’s allowed redirect URIs.
Troubleshooting
Users Not Being Redirected to IdP
Users Not Being Redirected to IdP
Possible causes:
- Email domain doesn’t match the configured domain
- Connection is disabled
- Domain not properly configured in connection settings
Redirect URI Mismatch Error
Redirect URI Mismatch Error
Possible causes:
- Redirect URI not added to IdP’s allowed list
- Redirect URI copied incorrectly
- HTTPS/HTTP mismatch
Groups Not Mapping to Roles
Groups Not Mapping to Roles
Possible causes:
- Groups not included in ID token
- The mapping value does not exactly match the value in the token
- The IdP sent a display name where OpnForm expects an identifier, or vice versa
- The group claim is not configured in the ID token
- The IdP omitted groups because the user belongs to too many groups
groups or group claim, then copy one of its raw values exactly (including case) into the mapping. Configure the IdP to emit only the groups needed by this application if it omits a large group list.Callback Says the Sign-in Attempt Was Already Used
Callback Says the Sign-in Attempt Was Already Used
OAuth authorization codes can only be exchanged once. This commonly happens
when the callback URL is refreshed, revisited from history, or opened in a
second tab.Solution: OpnForm starts one fresh sign-in automatically. If that
cannot be completed, select Back to sign in and try again. Do not
refresh or reuse the callback URL. Clearing the browser cache is not
necessary.
User Creation Fails
User Creation Fails
Possible causes:
- Email claim missing from ID token
- Field mappings incorrect
- Account with same email already exists (account linking blocked for security)
Force Login Not Working
Force Login Not Working
Possible causes:
OIDC_FORCE_LOGINnot set totrue- No OIDC connections configured
- Environment variable not loaded (restart required)
Security Considerations
HTTPS Requirement
In production, all OIDC redirects require HTTPS. Ensure your application is served over HTTPS before configuring OIDC.State Validation
OpnForm generates and validates an OIDCstate value by default for login redirects. Callback requests without a valid, unexpired state are rejected to prevent login CSRF.
State validation can be disabled explicitly on an OIDC connection by setting options.require_state to false, but this is not recommended unless required for a legacy identity provider.
Account Linking
For security, OpnForm prevents automatic linking of existing accounts. If a user with the same email already exists but isn’t linked to the OIDC connection, authentication will fail with a message to contact the administrator.SSO-Only Accounts
Users created via OIDC SSO are created with:- Random 64-character password (prevents password-based login)
- Email automatically verified
- Provider metadata stored for tracking
Best Practices
- Test First: Always test with a small group before rolling out to all users
- Monitor Logs: Check application logs for OIDC-related errors during initial setup
- Backup Access: Ensure at least one admin account can still access the system if OIDC fails
- Regular Updates: Keep your IdP configuration in sync with OpnForm connection settings
- Documentation: Document your IdP configuration for future reference
With properly configured OIDC SSO, your users can seamlessly authenticate
using their organization’s identity provider, improving security and user
experience.