Keycloak Walkthrough
A concrete end-to-end walkthrough for connecting Keycloak to Elsa External Authentication and signing in from Elsa Studio.
This walkthrough uses the Elsa 3.8 preview packages from Feedz. External Authentication is under active development. Use sample credentials only in an isolated development environment.
This walkthrough makes the provider-neutral configuration concrete with Keycloak. The same Elsa configuration model applies to Microsoft Entra ID, Auth0, Okta, OpenIddict, and other conforming OpenID Connect providers.
Before starting, complete installation and choose a Studio host model.
Values Used in This Walkthrough
Elsa API base URL
https://elsa.example/elsa/api/
Studio URL
https://studio.example
Keycloak issuer
https://login.example/realms/elsa
Connection key
keycloak
Provider client ID
elsa-server-broker
Studio Server Authentication Client ID
elsa-studio-server
Studio WebAssembly Authentication Client ID
elsa-studio-wasm
Replace every example hostname and secret before running the configuration.
1. Create the Keycloak Realm and User
In Keycloak:
Create or select a realm, such as
elsa.Create a test user and set a password.
Ensure the account may complete the standard authorization-code flow.
Add any provider claims you intend to project or use for authorization, such as
email,preferred_username, or a realm role.
External Authentication validates the provider identity and then resolves it to an Elsa User. A Keycloak role does not automatically grant an Elsa permission.
2. Register Elsa Server at Keycloak
Create a confidential OpenID Connect client for Elsa Server:
Enable the standard authorization-code flow.
Disable implicit flow.
Require client authentication.
Use
client_secret_basicwhen available;client_secret_postis also supported.Register the exact normal callback URI:
If administrators will run interactive connection previews, also register the preview callback URI shown by the connection detail screen. It uses the connection record ID and is intentionally different from the normal callback.
Do not register a Studio callback at Keycloak. Keycloak redirects to Elsa Server; Elsa later redirects to the registered Studio Authentication Client.
Copy the generated provider client secret into a deployment secret store. Do not put it in adapterSettings, source control, a browser application, or a Studio connection document.
3. Configure the Provider Connection
The following example creates a deployment-owned connection. In a conventional host, place it under the root ExternalAuthentication section. In Modular Server, place the same object inside the ExternalAuthentication feature configuration.
Supply the referenced value through deployment configuration, for example an environment variable named ExternalAuthentication__Secrets__KeycloakClientSecret. Do not add the value to the JSON file.
Assigning the admin role on just-in-time creation is convenient for an isolated walkthrough, but it grants full Elsa access when that role contains *. Use least-privilege roles and explicit permission grants in a real environment.
BindExternalAuthenticationOptions preserves the adapter's versioned JSON settings. Do not replace it with a plain options bind in a conventional host.
4. Register Studio as an Elsa Authentication Client
For Studio Server, add a confidential Authentication Client:
For Studio WebAssembly, use a public client, omit the secret, and register the exact browser origin:
If both Studio hosts are deployed, give each its own Authentication Client ID and exact URLs.
5. Configure Studio
Set Authentication:Provider to ExternalAuthentication and choose the matching host configuration from Studio Integration. Do not register direct OIDC and brokered External Authentication in the same Studio host.
Restart Elsa Server and Studio after changing deployment-owned configuration.
6. Validate the Connection
In Studio:
Open Administration → Identity & access → Identity provider connections.
Open the
Keycloakconfiguration-owned connection.Confirm the displayed callback URI exactly matches the Keycloak client registration.
Run Validate to check local structure and secret-binding state.
Run Test connection to fetch discovery metadata and signing keys.
Run Preview sign-in to verify the provider identity without creating a user, link, credential, or normal session.
Configuration-owned connections are read-only in Studio. If deployment policy permits overrides, Studio can create a complete database-owned override; it never partially merges settings or copies secret values.
7. Sign In
Sign out of Studio and open
/login.Select Keycloak. A preferred connection may be emphasized or sorted first, but Studio never auto-starts it.
Authenticate at Keycloak.
Confirm Elsa returns to Studio and creates or resolves the expected Elsa User.
Verify a normal session appears under Administration → Identity & access → Authentication sessions when session administration is enabled.
Verify the user can perform only the Elsa operations allowed by their Elsa roles and permissions.
Keep local login enabled until this complete path and a recovery account have been tested.
Provider Variations
For Microsoft Entra ID, Auth0, Okta, and other providers, change the discovery URL, provider client registration, allowed egress host, scopes, and claim selection. The Elsa callback shape, Authentication Client distinction, PKCE completion flow, identity linking, Elsa-issued credentials, and explicit authorization model remain the same.
Next Steps
Last updated