Configure Single Sign-On
Configure OIDC, SAML 2.0, or CAS login connections and manage the SSO user lifecycle
Login identity sources are managed in one place under Site Settings → Integrations (/site-settings/integrations): login identity sources, email, webhooks, and the Feishu directory share one integration list, but their capabilities and permissions stay separate. Turn on the global SSO policy under Site Settings → Security first, then add login integrations one by one.
Each login integration's protocol configuration is a JSON document whose fields depend on the type. Before saving, have the identity provider's callback address, client credentials, and certificate ready.
Prerequisites:
- The global SSO switch is on; otherwise the sign-in page shows no SSO buttons.
- The operator has permission to view or modify login integrations (Super Admins always do).
- The identity provider can reach Clouisle's public backend address; otherwise callbacks never arrive (see the next section).
Supported Scope
| Type | Purpose | Where it is managed |
|---|---|---|
| OAuth2, OIDC, SAML 2.0, CAS | Web sign-in | The login integration dialog under Site Settings → Integrations |
| Email, Webhook | Notification delivery | Their own dedicated forms |
| Feishu | Sign-in and directory sync | The Feishu integration card (one set of app credentials, capabilities toggled separately) |
Feishu is one integration that offers both directory sync and web sign-in: enabling the Feishu integration does not by itself grant sign-in, which must be explicitly switched on in the same card; disabling the integration turns off both directory sync and sign-in but keeps that choice. Email, webhook, and Feishu are single-instance integrations; this page covers the sign-in part only.
Callback Address
The callback (redirect) address to register with the identity provider is:
https://your-domain.com/api/v1/sso/callback/<integration-name>your-domain.comis the public address the browser actually uses to reach the backend: behind a reverse proxy, use the proxy's forwarded public address; if the frontend proxies the API paths, use the public frontend domain. It is not an internal service address and not a frontend page address — using the wrong one makes the callback fail or redirect to the wrong domain.- Build the address from the pattern above (domain + integration name); the Feishu integration card displays a copyable redirect address directly.
<integration-name>must exactly match the integration name registered in Clouisle, is case-sensitive, and stays stable after creation. A mismatched callback address is the most common cause of SSO sign-in failures.
Adding a Login Integration
Under Site Settings → Integrations, add a login integration. The dialog has three tabs: Basic Info, Configuration, and Attribute Mapping. Basic info:
| Field | Required | Constraint |
|---|---|---|
| Integration Name | Yes | Starts with a lowercase letter; only lowercase letters, digits, -, _; up to 100 characters; globally unique (a duplicate reports that the name already exists) |
| Protocol | Yes | OAuth2 / OIDC / SAML 2.0 / CAS |
| Display Name | Yes | Shown in the list and on connected-account cards, up to 100 characters |
| Button Text | No | Sign-in button label, up to 50 characters, e.g. "Continue with GitHub" |
| Icon URL | No | Must start with http:// or https://, up to 512 characters |
| Enabled | — | When off, the integration does not appear on the sign-in page |
| Allow Signup | — | Lets this integration create accounts on first sign-in |
| Require Approval | — | New accounts need administrator approval before they can sign in |
| Default Role | No | Initial global role for new accounts; empty falls back to the site default role |
The integration name and protocol cannot be changed after creation. Name it to match your identity provider's configuration; renaming means recreating the integration, and existing user identity connections stay on the original integration.
Protocol Configuration
On the Configuration tab, fill in two JSON documents:
- Configuration JSON: protocol parameters. Field names must match the tables below; a typo is not caught on save and instead surfaces as a configuration error at sign-in.
- Credentials JSON: sensitive values such as the client secret, e.g.
{"client_secret": "..."}. Never put secrets in Configuration.
Credentials are stored encrypted and never echoed back: when editing, you see which keys are configured, and leaving the JSON empty preserves the saved secret.
OAuth2 / OIDC
| Field | Required | Description |
|---|---|---|
client_id | Yes | Client ID issued by the provider |
authorization_url | Yes | Authorization endpoint |
token_url | Yes | Token exchange endpoint |
userinfo_url | Yes | Userinfo endpoint (its response is what sign-in reads) |
scopes | No | Space-separated scopes, default openid email profile |
Sign-in uses the authorization code + PKCE (S256) flow and generates a nonce.
The current implementation has no Issuer URL field and performs no ID Token signature/JWKS validation: user information always comes from the userinfo_url response. A wrong client secret or an expired certificate therefore only surfaces during the actual token exchange — see Test Connection.
SAML 2.0
| Field | Required | Description |
|---|---|---|
sp_entity_id | Yes | Service Provider Entity ID (this instance's identifier) |
idp_entity_id | Yes | IdP Entity ID |
sso_url | Yes | IdP single sign-on URL (HTTP-Redirect binding) |
x509_cert | Yes | IdP X.509 certificate: PEM content without the -----BEGIN/END CERTIFICATE----- lines |
acs_url | Yes | ACS address; a placeholder/reference only — the actual callback address always overrides it at runtime |
slo_url | No | SP single logout address |
idp_slo_url | No | IdP single logout address |
name_id_format | No | NameID format, default urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified |
{
"sp_entity_id": "clouisle",
"idp_entity_id": "https://idp.example.com/metadata",
"sso_url": "https://idp.example.com/sso",
"x509_cert": "MIIC...omitted...",
"acs_url": "https://your-domain.com/api/v1/sso/callback/azure-ad"
}Strict mode is on: SAML responses must pass signature validation, and a large clock skew between the IdP and Clouisle fails them outright.
slo_url / idp_slo_url are stored only — SP-initiated single logout is not implemented: signing out at the IdP does not sign the user out of Clouisle.
CAS
| Field | Required | Description |
|---|---|---|
server_url | Yes | CAS server base URL |
version | No | Protocol version 1 / 2 / 3, default 3, which decides the validation endpoint (/validate, /serviceValidate, /p3/serviceValidate) |
service_url | No | Has no effect: the service parameter always uses the runtime callback address |
The CAS user identifier comes from <cas:user> in the validation response; version 3 also reads attributes from <cas:attributes> for attribute mapping.
Attribute Mapping
The Attribute Mapping tab holds a JSON document that maps provider response data to the fields Clouisle needs:
| Clouisle field | Purpose |
|---|---|
email | Account email (required; missing means sign-in fails) |
username | Username; duplicates get a numeric suffix |
avatar_url | Avatar address |
Two path styles:
- Dot notation (default):
{"email": "email", "username": "profile.name"}reads nested objects. - JSONPath: starts with
$, suits arrays or filtering, e.g.{"email": "$.emails[0].value"}; the first match wins.
Default values for a new integration:
{
"email": "email",
"username": "name",
"avatar_url": "picture"
}GitHub returns different fields from the OIDC standard, so change it to {"email": "email", "username": "login", "avatar_url": "avatar_url"}.
Mapped results are merged with the provider's raw response, and same-named raw fields win. In other words, the mapping only takes effect for keys absent from the raw response; if the provider already returns email, the mapped email is overwritten. When debugging mismatched fields, inspect the raw response first.
The final data must contain a non-empty email; otherwise new-user creation fails with a missing-email error. The OIDC sub/id, the SAML NameID, and the CAS <cas:user> become the external identity identifier; an empty identifier also fails sign-in.
Configuring GitHub Sign-In
- Make Clouisle externally reachable, and keep a working administrator sign-in method.
- Configure the global SSO policy under Site Settings → Security: the SSO switch, password sign-in, automatic user creation, approval, and email matching.
- In GitHub's Settings → Developer settings → OAuth Apps, create an OAuth app and set the callback to
https://your-domain.com/api/v1/sso/callback/github. - Create an OAuth2 login integration named
githubwith a display name, button text, and icon; enable Allow Signup / Require Approval as needed and choose a default role. - In Configuration, enter the Client ID, authorization URL, token URL, userinfo URL, and scope (
read:user user:email); set Attribute Mapping to{"email": "email", "username": "login", "avatar_url": "avatar_url"}. - In Credentials, enter
{"client_secret": "..."}— not in Configuration. After saving and testing, complete a real sign-in in a private browser session; a passing configuration test does not mean a full sign-in works.
Configuring Feishu Sign-In
Feishu web sign-in is an optional capability of the Feishu integration and shares the same App ID / App Secret as directory sync, so no additional identity source is needed.
- In the Feishu developer console, add the Feishu card's redirect address (
https://<backend-host>/api/v1/sso/callback/<integration-name>, e.g.…/api/v1/sso/callback/feishu) to the app's redirect URL allowlist; the address can be copied from the card in one click. - Grant the app the scopes needed for sign-in:
contact:user.base:readonly contact:user.email:readonly. - Under Site Settings → Integrations → the Feishu card, turn on the Feishu sign-in switch in the capabilities area and optionally set the login button text. The sign-in switch belongs to login-integration permissions while the rest of the Feishu card belongs to integration-settings permissions, so the operator usually needs both.
- If app credentials are not configured yet, fill them in on the same card; they are shared with directory sync, and leaving the secret blank preserves the current value. Keep the integration enabled.
Members can link a Feishu identity to an existing account from the Connected Accounts area under Personal Settings → Account by clicking Link Feishu; this entry also appears only after an administrator enables Feishu user login.
The sign-in page shows the Feishu button only when global SSO is enabled, the integration is enabled, and the Feishu sign-in switch is on. Without that option, Feishu only provides directory sync. Disabling the integration turns off both capabilities but keeps the option.
The sign-in identity is stored using union_id from the Feishu profile as the external identity identifier, falling back to open_id when it is missing, so changing the app within the same developer account does not break already-linked accounts.
Feishu accounts with no email in the directory receive a deterministic placeholder email (the same one directory sync uses), so sign-in and sync converge on one local account instead of creating separate ones. Deriving that address requires the Feishu user_id, hence the contact:user.employee_id:readonly scope; without it such accounts have no user_id and their first sign-in is rejected rather than creating a placeholder identity.
Test Connection
The Test Connection button on an integration card builds an authorization address locally on the server once (with a placeholder callback) and checks whether the required configuration keys are present:
- Success only means the configuration can produce an authorization address.
- It never contacts the identity provider, so a wrong client secret, a mismatched callback address, or an expired certificate cannot be detected — verify with a real sign-in.
General Flow
- Under Site Settings → Security, enable SSO and adjust the global policy (allow password sign-in, auto-create, require approval, match by email).
- Under Site Settings → Integrations, add a login integration: fill in the basic info and choose the protocol.
- On the Configuration tab, enter the protocol's JSON configuration; put secrets in Credentials, not Configuration.
- On the Attribute Mapping tab, map email, username, and avatar to the provider's fields.
- After saving, put the callback address (
https://your-domain.com/api/v1/sso/callback/<integration-name>) into the identity provider's allowlist/redirect settings. - Verify three cases in a private window: a new user, an existing user, and a wrong callback.

User Lifecycle
Global policy and per-integration settings combine with OR semantics:
| Outcome | Rule |
|---|---|
| Link an existing account | Global "match existing accounts by email" is on (the default) and the returned email matches an existing user; linking also ensures the user joins the default team |
| Create a new account | Global "auto-create users" or the integration's own "allow signup" is on |
| Creation refused | Global auto-create is off and the integration's allow-signup is also off |
| Approval required | Global "new accounts require approval" or the integration's "require approval" is on → the account is pending and cannot sign in |
| SSO only | Global "allow password sign-in" is off, so password sign-in is rejected |
New SSO users have these traits:
- No local password, so they cannot sign in with a password.
- The email is marked verified (the provider's email is trusted).
- The username comes from the mapped
username; when missing, the part of the email before@; when that is missing too, the first 8 characters of the external identity identifier with a prefix. Duplicates get a numeric suffix. - The role comes from the integration's default role, falling back to the global default role; the user then joins the default team per the default-team setting.
Upgrade Notes
When upgrading from the legacy SSO provider model to the unified integration model: the upgrade preserves integration identifiers, user identity connections, and external identity IDs — accounts do not need re-linking and identity providers do not need callback changes.
Back up the database before upgrading and update all components in the order the upgrade guide specifies; rolling deployment with mixed versions is not supported. A rollback must restore the pre-switch database, a matching application version, and the encryption key together. See Upgrading Clouisle for the full upgrade and rollback steps.
Troubleshooting
No SSO Button on the Sign-In Page
- Check that the global SSO switch under Site Settings → Security is on.
- Check that the integration is enabled and, for Feishu, that the Feishu sign-in switch is on.
- Confirm the callback address configured at the identity provider matches the pattern above.
Callback Errors / Stuck on the Same Page
- Verify that the callback address's public domain and integration name exactly match the configuration.
- Confirm the public address is reachable by the identity provider.
- Check whether the user lingered on the consent page (the sign-in session is valid for 10 minutes; retry after that).
- Look for failed SSO sign-in entries and error messages in the audit log.
Sign-In Succeeds but Fields Are Wrong
- Check the path style used in attribute mapping (dot notation vs
$JSONPath). - Remember that same-named raw fields override mapped values.
- Non-OIDC-standard providers such as GitHub need explicit mapping (
login,avatar_url).
SAML Validation Fails
- The certificate must be PEM content with the header/footer lines removed.
- Confirm the IdP and the server are time-synchronized (large skew makes responses invalid).
- Confirm
idp_entity_idexactly matches the Entity ID in the IdP metadata.
Feishu Callback Rejected or No Account Created
- Confirm the app has registered the integration's callback address (as shown on the Feishu card).
- Confirm the sign-in scopes include
contact:user.email:readonly; accounts with no email in the directory also needcontact:user.employee_id:readonly, otherwise there is nouser_idto derive the placeholder email and first sign-in is rejected. - If browsing or syncing Feishu departments says the integration is disabled: save the App ID and App Secret first, then enable the Feishu integration and turn on directory sync.
Nobody Can Reach the Admin Area After Disabling Password Sign-In
This is the classic SSO-only accident: confirm that at least one Super Admin has a linked identity connection first. If you are already locked out, platform operations must restore the password sign-in switch on the server.
Related Documentation
- SSO API — sign-in flow, integration management endpoints, and error codes
- Sign-in and Account Security — sign-in protection and first SSO sign-in behavior
- Personal Account Settings — disconnecting connections and the anti-lockout guard
- Site settings reference — defaults for SSO and security policy
- Upgrading Clouisle — migrating from the legacy SSO model and rolling back
How is this guide?