Articles in this section

Signing in with Keycloak

Published:
Updated:

This article explains how single sign-on with Keycloak works in MobilityManager, for both users and the administrator who sets it up.

Signing in with Keycloak

  1. Open the sign-in page and select your company (tenant).
  2. Choose the single sign-on button. When the provider is Keycloak, its default label is Login with Keycloak (your administrator may have set a custom label).
  3. You are redirected to your Keycloak realm to sign in.
  4. Keycloak returns you to MobilityManager, which verifies the response and starts your session.
Note: On your first Keycloak sign-in, an account is created automatically with the Driver role. See "How single sign-on users are provisioned."

What your administrator configures

A SystemAdmin creates a client in your Keycloak realm and enters these values per company in MobilityManager:

SettingValue for Keycloak
ProviderKeycloak
AuthorityYour realm URL, for example https://keycloak.example.com/realms/<realm>
Client IDThe client ID configured in the Keycloak realm
Client secretThe client secret for a confidential client (stored securely, never displayed back)
Redirect URIThe MobilityManager callback URL, added as a valid redirect URI on the Keycloak client
ScopesDefaults to openid profile email
Button textOptional; defaults to "Login with Keycloak"

How the Keycloak flow works

When a user starts SSO, MobilityManager builds an authorization request to the Keycloak endpoint at {authority}/protocol/openid-connect/auth, requesting an authorization code, and includes a state value for CSRF protection. After the user authenticates, Keycloak returns an identity token that MobilityManager validates using the realm's published discovery document and signing keys, checking the signature, issuer, audience, and lifetime before starting the session.

Tip: The Authority must point at the specific realm, not the Keycloak base URL. MobilityManager reads the realm's /.well-known/openid-configuration from that Authority to discover the endpoints and keys.

Troubleshooting

SymptomLikely cause
"Invalid redirect_uri" at KeycloakThe callback URL is not listed as a valid redirect URI on the client.
"Identity provider token validation failed"Authority points at the wrong realm, the client ID does not match the token audience, or the client is public rather than confidential.
"OIDC configuration is incomplete for this tenant"Authority or client ID is missing in the company's SSO settings.
An email account already existsA local password account uses the same email; an administrator must link it explicitly.

Related

  • Single sign-on: an overview
  • Signing in with Azure AD (Microsoft Entra ID)
  • Signing in with ADFS or a generic OIDC provider
  • How single sign-on users are provisioned
AH
Written by Alexander Hagemann
Updated:
Access denied
Access denied