Set up OIDC SSO with Keycloak
This guide walks you through configuring Keycloak as the OIDC identity provider for Gluesync CoreHub.
For the underlying OIDC concepts (claim path syntax, role mapping rules, login flow), see OIDC (OpenID Connect) Authentication.
Before you begin
You need:
-
A running Keycloak instance (this guide is verified against Keycloak 22+, but earlier versions with the same admin console flow work too — see the [legacy] note for pre-19 installs).
-
Administrative access to the Keycloak realm you want Gluesync to authenticate against.
-
Administrative access to your Gluesync CoreHub.
-
The HTTPS URL of your Gluesync instance (referred to below as
https://gluesync.example.com).
|
On older Keycloak versions (≤ 18), the admin console uses a slightly different UI and |
High-level flow
-
Create (or pick) the Keycloak realm Gluesync will authenticate against.
-
Register a confidential client for Gluesync in that realm.
-
Create realm roles (
gluesync-admin,gluesync-manager,gluesync-vieweror whatever naming you prefer). -
Assign roles to your users.
-
Configure OIDC in Gluesync CoreHub, using
realm_access.rolesas the role claim path.
Step 1 — Choose or create the realm
-
Open the Keycloak admin console.
-
In the realm switcher (top-left), either select an existing realm (for example
masterfor testing, or your tenant realm) or create a new one via Create realm.
The realm name appears in the issuer URL:
https://keycloak.example.com/realms/\{realm-name}
This is the value you will use as issuerUrl in Gluesync (Step 5).
Step 2 — Register a client for Gluesync
-
In the selected realm, go to Clients → Create client.
-
General settings:
-
Client type:
OpenID Connect -
Client ID:
gluesync-client(any value works; remember it for Step 5) -
Click Next.
-
-
Capability config:
-
Client authentication: on (this makes the client confidential and enables
Client secret). -
Standard flow: on (this is the Authorization Code Flow).
-
Direct access grants: off (not used by Gluesync).
-
Click Next.
-
-
Login settings:
Field Value Valid redirect URIs
https://gluesync.example.com/oidc/callbackValid post logout redirect URIs
https://gluesync.example.com/ui/v2/loginWeb origins
https://gluesync.example.comRoot URL / Home URL
https://gluesync.example.com(optional, useful for the account console) -
Click Save.
-
Open the Credentials tab on the client page and copy the Client secret — you will paste it into Gluesync in Step 5.
|
Keep Standard flow on and Implicit flow off. Gluesync only supports the Authorization Code Flow with PKCE. |
|
Valid post logout redirect URIs must include Without that exact URI on the Keycloak client, Keycloak rejects the logout redirect and the user is stuck on an identity-provider error page even though CoreHub has already ended the local session. |
Step 3 — Create realm roles
-
In the same realm, go to Realm roles → Create role.
-
Create the roles you want to expose to Gluesync. A typical setup uses three roles:
-
gluesync-admin— will map toSUPER ADMIN. -
gluesync-manager— will map toMANAGER. -
gluesync-viewer— will map toVIEWER.Save each one.
-
|
You can also use client roles (defined on the Gluesync client itself instead of at the realm level). In that case the role claim path becomes |
Step 4 — Assign roles to users
-
Go to Users, select (or create) the user that will log into Gluesync.
-
Open the Role mapping tab → Assign role.
-
Switch the filter to Filter by realm roles and select the role created in Step 3.
-
Click Assign.
Step 5 — Configure OIDC in Gluesync CoreHub
-
Log in to CoreHub as the local
adminuser. -
Go to Settings → OIDC Authentication.
-
Fill in:
Field Value Enable OIDC
toggle on
Provider Name
KeycloakIssuer URL
https://keycloak.example.com/realms/{realm-name}(use/auth/realms/{realm-name}on Keycloak ≤ 18)Client ID
gluesync-client(from Step 2)Client Secret
from Step 2
Redirect URI
https://gluesync.example.com/oidc/callback— must match Step 2Scopes
openid,profile,emailRole Claim Path
realm_access.roles(orresource_access.gluesync-client.rolesif you used client roles instead)Default Role
VIEWERAuto-provision Users
on
Role Mappings
{ "gluesync-admin": "SUPER_ADMIN", "gluesync-manager": "MANAGER", "gluesync-viewer": "VIEWER" } -
Click Save.
Equivalent REST API payload:
{
"enabled": true,
"providerName": "Keycloak",
"issuerUrl": "https://keycloak.example.com/realms/your-realm",
"clientId": "gluesync-client",
"clientSecret": "your-client-secret",
"redirectUri": "https://gluesync.example.com/oidc/callback",
"scopes": ["openid", "profile", "email"],
"roleClaimPath": "realm_access.roles",
"defaultRole": "VIEWER",
"autoProvisionUsers": true,
"roleMappings": {
"gluesync-admin": "SUPER_ADMIN",
"gluesync-manager": "MANAGER",
"gluesync-viewer": "VIEWER"
}
}
Step 6 — Verify
-
Log out of Gluesync (or open a new private browser window).
-
Click Login with Keycloak on the login page.
-
Authenticate with the test user.
-
After redirect, you should land in CoreHub. Open Settings → User Management and confirm the user appears with an
OIDCbadge and the resolved role.
To double-check the resolution end to end, you can decode the MOLO17 session token (visible in the browser dev tools as a cookie, or in the response of the /oidc/callback?code=… request) and confirm the role claim. For example, a user with the gluesync-manager realm role should produce:
{
"iss": "MOLO17",
"sub": "your-username",
"role": "MANAGER"
}
Using client roles instead of realm roles
If your operational model already groups roles per application using client roles, configure Gluesync as follows:
-
In the Gluesync client, open the Roles tab and create the roles there (instead of in Realm roles).
-
Assign these client roles to users from Users → Role mapping → Filter by clients → pick the Gluesync client.
-
In CoreHub, set
roleClaimPathto:resource_access.gluesync-client.roles
Replace
gluesync-clientwith the actual client ID you configured in Step 2.
|
If your client ID itself contains dots (for example resource_access.com\.example\.gluesync.roles See the claim-path syntax reference for details. |
Local development with self-signed certificates
The Gluesync Docker Compose kit ships a Keycloak instance with a self-signed certificate. When pointing CoreHub at it, enable the Skip TLS Verification toggle in Settings → OIDC Authentication → Advanced settings.
|
Never enable Skip TLS Verification in production. It disables all TLS certificate validation for the OIDC discovery, token-exchange, and userinfo calls. |
Troubleshooting
Failed to fetch OIDC discovery document
-
Verify the issuer URL is reachable from the CoreHub host:
curl -k https://keycloak.example.com/realms/{realm-name}/.well-known/openid-configuration. -
On Keycloak ≤ 18 the realm path includes
/auth/realms/, not/realms/. UpdateissuerUrlaccordingly. -
If you are using a self-signed certificate, enable Skip TLS Verification in the OIDC Advanced settings.
Users receive VIEWER instead of the expected role
-
Check the token contents. In the Keycloak admin console, open the Gluesync client → Client scopes → Evaluate, pick the test user, and click Generate. Inspect the generated ID token / userinfo: the role you assigned should appear under
realm_access.roles(orresource_access.{client-id}.rolesif you use client roles). -
Verify
roleClaimPathmatches what you saw in the previous step. AroleClaimPathofrealm_access.rolescannot find a role that only exists atresource_access.gluesync-client.roles. -
Verify the mapping keys.
roleMappingskeys are compared case-insensitively, but the full string must match.gluesync-managerwill not matchgluesync_manager.
Failed to exchange authorization code
-
Re-check the Client Secret in CoreHub against the Credentials tab in Keycloak.
-
Confirm the redirect URI configured in Keycloak exactly matches the one CoreHub sends (including scheme, host, port, and
/oidc/callback). -
If you regenerated the client secret in Keycloak, you must update it in CoreHub.
Stuck on a Keycloak error page after Logout
-
Cause: Valid post logout redirect URIs does not include the exact URI CoreHub sends as
post_logout_redirect_uri. -
Solution: On the Gluesync client, add
https://gluesync.example.com/ui/v2/loginto Valid post logout redirect URIs. Gluesync does not take a custom Signout URL.
Roles in the token but still falling back to default
-
Open the Keycloak Client scopes tab on the Gluesync client and confirm the
rolesclient scope is in the Default list. By default it is, but custom scope configurations sometimes remove it. Without therolesscope, Keycloak omitsrealm_access.rolesfrom the token.
For more general troubleshooting, see the troubleshooting section of the main OIDC page.