-
Notifications
You must be signed in to change notification settings - Fork 0
Comparison: SSO Gateway vs. Keycloak Adapter
Spencer Rose edited this page Jul 11, 2025
·
4 revisions
Benefits:
- Standards-Based & Provider-Agnostic: Supports any OpenID Connect-compliant provider, not just Keycloak.
- Backend Focused: Designed for Node.js server-side use (Express, Koa, etc.).
- Modern, Actively Maintained: Trusted by the broader Node.js/OAuth community.
- Explicit & Flexible: You control the OIDC flow, token handling, refresh, and session storage (e.g., Redis).
- No Keycloak Lock-In: You can switch OIDC providers without rewriting authentication logic.
Costs/Limitations:
- Less Keycloak-Specific Features: Doesn’t expose Keycloak-specific features (e.g., Keycloak session status, Keycloak-specific token endpoints, or easily handling Keycloak SSO logout).
- More Manual Work: You must handle session storage, token refresh, and user management.
- No Frontend Integration: Not intended for browser apps (SPAs); only backend/server use.
** Node.js/JavaScript Adapter keycloak-js**
Benefits:
- Keycloak-Specific: Deep integration with Keycloak, including session status, SSO logout, and fine-grained Keycloak features.
- Easy Frontend SSO: Designed for use in browser apps (React, Angular, Vue, plain JS).
- Automatic Token Handling: Manages token refresh and Keycloak session for you.
- Official Support: Maintained by the Keycloak team, versioned alongside Keycloak server releases.
Costs/Limitations:
- Frontend Only: Not suitable for Node.js backends; meant for browser-based SPAs.
- Keycloak Lock-In: Tightly coupled to Keycloak; switching to another IdP is difficult.
- Heavier: Loads the Keycloak JS library into the browser, which may affect bundle size.
- Less Flexibility: Less control over the authentication flow and token storage.
Feature | openid-client | keycloak-js |
---|---|---|
Use Case | Node.js backend | Browser (SPA) |
Provider Support | Any OIDC | Keycloak only |
Flexibility | High | Medium/Low |
Keycloak-specific features | No | Yes |
Session & Token Management | Manual | Automatic |
Lock-in | No | Yes |
Official Keycloak Support | No | Yes |
Frontend Token Handling | No | Yes |
-
For Node.js backends:
Stick with SSO Gateway (openid-client). Can use for any OIDC provider, including Keycloak. -
For browser-based SPAs (React, Angular, etc.):
Use the JS adapter if you want seamless Keycloak SSO, session management, and features like silent refresh and SSO logout.