socialiteproviders/keycloak
Keycloak OAuth2 provider for Laravel Socialite. Adds a Keycloak driver so your app can authenticate users through a self-hosted or cloud Keycloak realm, handling the OAuth redirect, callback, and user retrieval with Socialite's familiar API.
Architecture fit. socialiteproviders/keycloak is a thin OAuth2 driver that plugs Keycloak into Laravel Socialite via the socialiteproviders/manager extension mechanism. It is not a full Keycloak integration: it covers the authorization-code login flow and basic user retrieval, but does not provide role/group mapping, admin API access, token refresh orchestration, back-channel or RP-initiated logout, or SAML. It fits cleanly if the product requirement is "let users sign in with our Keycloak IdP from a Laravel app" and the app already treats Socialite as its identity abstraction. It is a poor fit if Keycloak is expected to be the source of authorization decisions (roles, groups, fine-grained permissions) inside the app.
Integration feasibility. Low effort. The package is installed via Composer, registered through a service provider plus a SocialiteWasCalled event listener, and configured through config/services.php (client_id, client_secret, redirect, base_url, realms). A developer familiar with Socialite can complete a working login in a few hours against a test realm. The main configuration nuance is matching base_url/realm paths to the Keycloak distribution in use (legacy WildFly-style paths vs. the Quarkus distribution introduced with Keycloak 17+), plus correct redirect URI registration in the Keycloak client.
Technical risk. Moderate to high for anything mission-critical. The signals are weak: 22 stars, a 0.5 score, a last release of April 2023, and an "unknown" repository because this is a read-only subtree split of SocialiteProviders/Providers. That means issues and PRs do not live here, maintenance is centralized in a large monorepo, and the package's release cadence is tied to that project rather than to Keycloak or Laravel. Specific risks: unverified compatibility with current Laravel/Socialite majors (Laravel 11/12, Socialite 5.x+), no evident security-response process, single-maintainer/bus-factor exposure, and behavioral drift if Keycloak changes token or endpoint semantics. The code surface is small enough that forking or reimplementing in-house is realistic, which materially reduces the strategic risk but not the day-to-day maintenance risk.
Key questions.
base_url/realms config model match our deployment?Stack fit. Best suited to a Laravel application already using Socialite for one or more providers, where Keycloak is one additional identity source. The package expects the standard Socialite contract: a service provider, an event listener registered in EventServiceProvider, and a services.keycloak config block. Applications using raw OAuth clients, SAML, or a custom auth guard will get less value and should weigh a direct OAuth2 client instead.
Migration path. If Socialite is already in place, this is additive: install the package, register the provider and listener, add config, wire routes for redirect and callback, and map the returned Socialite user to the local user model. If the app currently authenticates against Keycloak via a custom OAuth implementation or SAML, migrate behind a feature flag and run both paths in parallel until claim mapping and user provisioning are proven. If the app has no Socialite usage, adopt Socialite first as a separate decision — do not let this package force that architecture.
Compatibility. Treat compatibility as unproven until tested. Pin the package version in composer.json, verify the installed Socialite major, and confirm the Keycloak realm's endpoint paths. Validate PHP version constraints. Because the last release predates recent Laravel majors, assume a compatibility spike is required and budget for a small patch or a local fork if the upstream constraint blocks installation. Also verify TLS trust, redirect URI exact-match behavior, and whether the Keycloak client is confidential or public.
Sequencing.
Maintenance. Low ongoing code maintenance but non-trivial dependency maintenance. The package is stable because it does little, but it is also stale. Ownership should sit with the platform/auth team, with a recurring quarterly check on upstream releases, Socialite major upgrades, and Keycloak version changes. Because this repo is a read-only split, issue triage and patching must target SocialiteProviders/Providers; plan for the possibility that fixes are not merged on our timeline and that we carry a fork.
Support. Community-only, no SLA, no vendor. Internal runbooks and an internal owner are mandatory. Escalation path is: check upstream monorepo issues, inspect the provider source (small enough to read end-to-end), patch locally or fork.
Scaling. The authorization-code flow is stateless at the provider level and scales with the Laravel app; Keycloak bears identity load. Real scaling concerns sit outside this package: session storage, token/claim caching, Keycloak realm and database sizing, and connection pooling to Keycloak. The provider adds negligible overhead.
Failure modes.
base_url/realm path mismatch after a Keycloak upgrade → callback or token exchange errors.Ramp-up. Small for a Laravel developer: hours to first working login, one to two days to production-grade with tests, claim mapping, logout, and fallback. The larger ramp-up is Keycloak-side configuration and operational familiarity (realms, clients, mappers, token lifetimes), which should be owned by whoever operates the IdP. Given the low star count and stale release, onboard with the explicit expectation that the team owns the code path, not the upstream maintainers.
How can I help you explore Laravel packages today?