Upgrading keycloak-js and Keycloak client libraries

A practical plan for the application side of a Keycloak upgrade: the order of server, adapters and client libraries, keycloak-js breaking changes, and the token and logout tests each app needs.

On this page

Why client library upgrades need their own plan in a Keycloak upgrade

Plan the application side of a Keycloak upgrade as a separate workstream, and run it after the server is upgraded. The Keycloak upgrading guide gives the order: review the migration changes, upgrade the server, upgrade adapters, then upgrade client libraries. The guide notes that client libraries may be released separately from the server, so a version of keycloak-js or an admin client that works today does not automatically follow the server you move to. Each step depends on the one before it, so the server change is the anchor and the client changes follow it.

Every application that signs in through keycloak-js, a server adapter or an admin client is its own test unit. A single-page app that calls the login API, a backend that validates tokens, and a service that uses the Admin REST client each break in different ways, and each has its own owner, release cycle and rollback path. Plan an inventory before the server change starts: list every application, the artifact and version it uses, how it obtains and refreshes tokens, and how it logs out. Confirm with each owning team which breaking changes apply to its artifact, because the upgrading guide lists removals by release and not every removal affects every application.

Which client library changes affect applications

This table lists the client-side changes in the supplied Keycloak facts that can break or alter application behavior, with the impact of each and the action to take. Read it as a checklist: each row names an application type or code path to inspect before the server and adapters move forward. The main takeaway is that the keycloak-js and admin client changes are code-level, so they need testing in every application, not only in the Keycloak environment.

ChangeImpactAction needed
Legacy Promise API removed from keycloak-js (22.0.0)Single-page apps that call the adapter's legacy Promise-based methods stop working after the upgrade.Search front-end code for legacy Promise calls, switch to the current API, and test login, token refresh and logout in each app.
Keycloak Admin client artifacts renamed (22.0.0)Build fails or admin scripts stop resolving dependencies after the artifact name changes.Update package and Maven coordinates to the new names, then rebuild and run admin automation against a test realm.
JS adapter must use the new operator (from 21.1.0)Apps still on older instantiation code may fail to initialize the adapter or behave inconsistently.Confirm every adapter instantiation uses the new operator form in the upgrade notes, and include initialization in smoke tests.
PKCE with S256 is the keycloak-js defaultApps that set a different PKCE method, or that rely on implicit-style flows, behave differently from the default.Review adapter options for the PKCE method, confirm the redirect and login flow in each browser-based app, and set the method explicitly if a client requires it.
Backchannel logout token signature validation (26.8)Applications or back-end services that accept logout tokens from external providers now reject unsigned or invalid tokens.Verify that each backchannel logout endpoint validates token signatures, and test logout from an external provider before rollout.

How the upgrade differs by application type

Single-page apps that load keycloak-js run the whole sign-in flow in the browser, so the upgrade risk sits in the JavaScript bundle and in how the app initializes the adapter. The Keycloak JavaScript adapter is distributed on npm as keycloak-js and defaults to PKCE with the S256 method, so confirm that your app either relies on that default or sets it explicitly. Keycloak 22.0.0 removed the legacy Promise API from the adapter, and from 21.1.0 the adapter must be instantiated with the new operator. Apps that were written against older versions often carry both patterns.

  • Adapter construction: Find every place the app creates the adapter and confirm it uses the new operator.
  • Promise handling: Search for .success( and .error( callbacks and replace them with standard promise or async handling.
  • Silent check-sso: Test whether the silent check iframe still works after your Keycloak hostname and redirect URI changes.
  • Token refresh: Confirm refresh runs before expiry and that a failed refresh sends the user to sign-in rather than leaving a broken screen.
  • Logout and back button: Check that logout clears local state and that the browser back button does not reopen a stale session.

Before release, check each single-page app in a browser build that uses the same keycloak-js version as production, with a test realm that matches production client settings.

What to inventory and prepare before changing any application

Application upgrades fail when teams discover their client list, package versions or rollback path mid-change. The cards below cover what to record and build before touching any app, so the server, adapter and client library steps can be tested and reversed with confidence.

Inventory every keycloak-js client

List each web, single-page and mobile application that loads keycloak-js or calls Keycloak through an adapter. For each one, record the owning team, the repository, the Keycloak realm and client ID it uses, and whether it is a browser app, a backend that validates tokens, or a service using the admin client. Keycloak 22.0.0 removed the legacy Promise API from the JS adapter, so apps that still rely on it appear here first and go to the top of the test queue.

JavaScript adapter guide

Record adapter and admin client artifacts

Find every use of deprecated adapters and Keycloak Admin client artifacts, including scripts, CI jobs and internal tools that create realms, users or clients. The upgrading guide documents renamed admin client artifacts from 22.0.0, so a search by package name and Maven or npm coordinates shows what must change in the same release window. Note which artifacts are built into a base image and which are pulled from a registry.

Keycloak upgrading guide

Pin versions and commit lockfiles

Confirm that every application pins its keycloak-js version and commits its lockfile, such as package-lock.json or yarn.lock. Unpinned ranges can pull a new adapter during an unrelated build and change token handling without a deliberate upgrade. Record the current versions per application so each upgrade is a reviewable diff, and so a rollback can restore the exact previous dependency tree.

Stand up a staging Keycloak at the target version

Run a staging server at the target Keycloak release, built from a copy of production configuration and connected to a restored copy of the production database. Staging is where client libraries are tested against the server they will meet in production. Ask your team which release is the target, read the migration notes for every release between the current version and that target, and confirm that staging is not shared with development traffic.

Keycloak upgrading guide

Export realms and back up the database

Export each realm's configuration, including clients, redirect URIs, web origins, client scopes and mappers, before any server change. Pair the exports with a restorable backup of the server database, and test that the backup restores into a separate instance. Realm exports do not replace the database backup, since sessions and user data live there. Without both, a failed client library change may be hard to reverse cleanly.

Keycloak database guide

Build a test account set per application

For each application, prepare test users that cover the roles, groups and organizations the app relies on, plus accounts that exercise MFA, password reset and any federated login path. Include an account whose session is started before the upgrade so token refresh and logout can be checked across the change. Keep these accounts in a separate realm or with clearly marked test identities, and document the expected result of each login and logout step.

Sequence the server, adapters and client libraries

The sequence keeps each application compatible with the Keycloak server it talks to at every point in the upgrade, so a failed step can be reversed without rolling back the whole identity platform. Each step closes with a check that must pass before the next one starts.

  1. Review migration changes for the target release

    The platform owner and the application leads read the upgrading guide and the release notes for every minor release between the current and target version, and list the changes that touch client libraries, keycloak-js, admin client artifacts, token claims, and logout behavior. Each application team marks which of its features depend on those changes. Keycloak documents that breaking changes in minor releases are opt-in, so the team also records which options must be enabled and which are off by default. The step is done when every application has a written list of affected items with an owner for each, and the list has been reviewed against the actual code paths in use.

  2. Upgrade the staging Keycloak server

    The platform team upgrades a staging Keycloak instance that uses a copy of production realms, clients and database data, and runs the schema migration as it would in production. Before any application is changed, the team confirms that existing clients still authenticate against the new server, since the current application builds are the rollback path. The check is that login, token issuance and admin console access work on staging, and that the migration finished without errors in the logs. Keep a restorable database backup taken before the upgrade so the staging run can be repeated from the same starting point.

  3. Upgrade server adapters and integration components

    Teams upgrade any server-side adapters, gateway plugins, reverse proxy integrations and custom providers that sit between applications and Keycloak, and test them against the upgraded staging server first. Adapter releases can ship separately from the server, so the team confirms that each adapter version supports the target server version before changing it. The check is that each server-side component completes an authorization code flow and validates tokens issued by the staging server. Keep the previous adapter build in the deployment pipeline so it can be redeployed without rebuilding.

  4. Upgrade keycloak-js and admin client artifacts

    Each single-page or browser application updates its keycloak-js dependency in a branch, replacing any removed Promise API calls with the current method and instantiating the adapter with the supported constructor pattern. Teams also update any Keycloak admin client packages used by backend scripts or services, adjusting for renamed artifacts. Keycloak documents that the Promise API was removed in version 22.0.0 and that the adapter must be instantiated with the new operator from 21.1.0, so older code will fail at build or runtime. The step is done when the application builds without deprecation errors and the unit tests that cover authentication wrappers pass. Keep the previous bundle deployable in the release pipeline until the next step passes.

  5. Test token acquisition, refresh and expiry

    QA and the application owner run scripted tests against staging that cover the first sign-in, silent renewal, refresh token rotation, token expiry during an open session, and access to protected API calls with the new token. Confirm that keycloak-js uses PKCE with the S256 method by default, and check that any application that overrides that default still matches the client configuration in Keycloak. The step passes when tokens are accepted by the backend APIs, refresh works without a forced login, and expired sessions redirect cleanly. If any check fails, redeploy the previous keycloak-js bundle to production while the client configuration is investigated.

  6. Test logout and back-channel behavior

    Testers check single logout from each application, logout from one application while another remains open, redirect targets after logout, and the handling of front-channel and back-channel logout where the application uses them. For the 26.8 line, the team also confirms that backchannel logout tokens from external providers are validated, since signature validation is mandatory there. The step passes when logout ends the Keycloak session and clears local tokens in every tested application, and when no logout redirect lands on an unregistered URI. Record the results per application so the production rollout order is based on evidence rather than assumption.

  7. Promote applications to production in sequence

    Once the staging tests pass, the team promotes the server upgrade first, then the adapters, then each application's client library update, one application or group at a time, in the order agreed during the review. Each promotion uses the same rollback point as staging, and the previous artifact stays deployable until the application has finished a monitored period agreed with the owner. Watch sign-in failure rates, token errors and logout errors in the logs and metrics during each promotion. The step is done when every application is on the target versions, the rollback artifacts are archived with their version numbers, and the change record lists the test results for each application.

How server, adapter and application upgrades fit together

The upgrade starts with reviewing the migration changes, then moves the Keycloak server through staging before anything else changes. Adapters come next, followed by client libraries such as keycloak-js, which can be released separately from the server and must be upgraded for each application. Each application then runs token and logout tests before production rollout, and a failed check sends it back to the prior client bundle.

Phases of a Keycloak upgrade across the server, adapters and each application.

How to test token handling and logout in each application

Test every application against the same checklist before approving a keycloak-js or client library upgrade, because the server release alone does not prove that a single-page app, a server-side web app or an API still handles tokens correctly. For each application, confirm that the login flow uses PKCE with the S256 method, which is the keycloak-js default, and that the authorization request carries a code challenge. Check that the app exchanges the code, stores tokens where your security design says they belong, and reaches its protected pages without a second prompt. Record the keycloak-js or library version, the Keycloak server version and the browser or runtime used for each run.

Next, exercise the token lifecycle. Force an access token to expire in a test realm with a short lifetime and confirm that the app renews it through the refresh token or silent renewal path, then that it sends the user to sign in again when renewal fails. Verify that logout clears local state (memory, session storage, cookies and any cached user profile) and that the app calls the end-session endpoint. Then confirm backchannel logout reaches the application: end a session in the admin console or a second app and check that the first app's session is invalidated. Because the Keycloak 26.8 upgrade notes make signature validation of backchannel logout tokens from external providers mandatory, include a test that a token with an invalid signature is rejected.

Finally, test admin API calls from any service that uses the Keycloak Admin client, since the artifacts were renamed in Keycloak 22.0.0 and the renamed package must be in the build. Confirm that the service obtains a token with the client credentials it is configured for, that calls succeed against a non-production realm and that failures are logged. Write these cases per application, because a React single-page app, a Java backend and a service account behave differently. Keep the completed case sheets, with pass or fail results and dates, as release evidence for your change record.

What makes the application side of an upgrade take longer

The server upgrade is usually the smaller part of the work. Application effort depends on how many services wrap keycloak-js, how much of the old API they use, and whether logout and token handling are covered by tests. The cards below describe the drivers that raise or lower that effort.

Number of applications and wrappers

Each single-page app, framework wrapper and shared authentication module that calls keycloak-js is a separate upgrade task. Teams often wrap the adapter in React, Angular or Vue helpers, so one library change can reach many apps at once. Inventory every application, its keycloak-js version and which wrapper it uses before estimating. Shared wrappers lower effort per app but raise the cost of getting a single change wrong.

Use of the legacy Promise API

Keycloak 22.0.0 removed the legacy Promise API from the Keycloak JS adapter, so any code that relies on it must move to the current calling style before the upgrade. Search for direct calls to the adapter's init, login, logout and token refresh methods and note which ones chain on the old style. Apps that already use the newer style need little more than a version bump.

Keycloak upgrading guide

Custom admin client code

Scripts, backend jobs and internal tools that call the admin API through a client library depend on artifacts that Keycloak renamed in version 22.0.0. Each custom admin client must be found, mapped to its new artifact name and retested against the target server version. Teams often miss standalone scripts kept outside the main repositories, so include CI jobs, cron tasks and operations runbooks in the inventory.

Custom logout flows

Applications that clear local state, call a custom end-session URL or coordinate logout with other systems need the most manual checks. Confirm how each app passes the ID token hint and post-logout redirect, and whether it relies on front-channel or back-channel logout. Plan to test single logout across every app that shares a realm, because one app with a custom flow can leave others signed in.

Test coverage gaps

Effort rises sharply where no automated test covers login, silent token renewal, token expiry and logout. Without those tests, each application needs manual sign-in and sign-out checks in a staging realm that matches production clients and redirect URIs. Ask each team which flows are covered by automated tests and which depend on a person clicking through. Gaps in these areas are where regressions usually appear after an upgrade.

Release coordination across teams

Applications owned by different teams often ship on different schedules, and some can only deploy in fixed change windows. The server, keycloak-js and client library versions must be agreed so that no team runs an unsupported combination for longer than necessary. Assign one owner for the compatibility matrix, set the order in which applications move, and agree a rollback path for each team before the upgrade window opens.

Effort drivers by application inventory

This table compares the application traits that most change the effort of a keycloak-js and client library upgrade, and what each trait means for the size of the test plan. Read each row as a question to answer for every application before estimating, since the total work grows with the number of applications that combine several of these traits.

DriverEffect on effortWhat to check
Application countEffort grows with every application, because each one has its own token handling, redirect URIs and logout path to testList every client in each realm, including internal tools and single-page apps that were added informally
Custom wrappers around keycloak-jsWrappers that hide init options, token refresh or the login callback multiply the code to review when the adapter API changesSearch each codebase for direct calls to the adapter and for in-house helpers that wrap it
Admin client usageServices that call the Keycloak Admin API through a client artifact need changes when artifact names or method signatures changeIdentify which packages each service imports and which admin operations it performs
Logout and session codeFront channel and back channel logout, idle timeout handling and multi-tab sessions are the paths most likely to break silentlyTrace logout end to end in each application, including what happens when the server session has already ended
Token handling and claimsApps that read custom claims, roles or the session_state value need checks for claim names and content in each releaseCompare decoded tokens from the old and new server releases for each client and scope
Automated test coverageThin coverage means most verification is manual, which raises the number of person-hours per applicationConfirm whether login, token refresh, role checks and logout have automated tests in each application
Legacy or unmaintained appsApplications that depend on older adapters or no longer have an owner usually need replacement work before they can be upgradedRecord an owner, a release history and an adapter type for each application before scheduling

Questions teams ask before upgrading Keycloak client libraries

What drives the cost of upgrading keycloak-js and other client libraries?

The cost follows the number of applications, how many of them use the Keycloak JavaScript adapter or an older adapter, and how much custom token and logout code each one contains. Applications that only use a standard OpenID Connect library with well-known settings usually need less change than single-page apps that call the adapter API directly. Ask for the cost to be broken down per application, separating inventory and planning, code changes, test runs and release support. One-time work covers the first upgrade; recurring work covers the libraries you update on each future Keycloak release.

How long does the application side of a Keycloak upgrade take?

No duration should be accepted without a written scope, because the time depends on the number of applications, their owners, release schedules and how well each one is tested today. A partner can only give a credible timeline after listing every client, its library and version, its login flow, its logout behavior and its test coverage. Ask the partner to show which steps run in parallel and which must wait for the server upgrade to finish in each environment.

What does the internal team need to provide for this work?

The team needs an accurate client inventory, access to each application's source repository and build pipeline, and named owners who can approve behavior changes. Engineers must be able to run the applications in a test environment that points at a Keycloak instance matching production. Security or identity staff should confirm the expected redirect URIs, PKCE settings and logout flows. Without these inputs, most of the effort shifts to discovery, which lengthens the work and raises the risk of missed logout paths.

Can our own team upgrade the client libraries without a partner?

Yes, if the team has engineers who know each application, can read the Keycloak upgrading guide for the target release, and can run realistic login, token refresh and logout tests. The main risks are untested logout behavior, outdated adapter calls that only fail at runtime, and admin client artifacts that were renamed and still referenced in build files. A partner is most useful when many applications share one identity platform and no single team owns the full set of tests.

Must client libraries move at the same time as the Keycloak server?

Not necessarily. The Keycloak upgrade procedure reviews migration changes, upgrades the server, then upgrades adapters and client libraries, which may be released separately from the server. The order matters because the server change can alter token or endpoint behavior that an application library depends on. Plan the server upgrade first in a test environment, confirm each application against it, and only then roll the library changes into production, keeping older and newer versions compatible long enough to roll back.

Which breaking API changes should we check in keycloak-js?

Check the removal of the legacy Promise API and the instantiation rule for the JavaScript adapter. Keycloak 22.0.0 removed the legacy Promise API from the Keycloak JS adapter and renamed the Keycloak Admin client artifacts, and from 21.1.0 the JS adapter must be instantiated with the new operator. Also confirm that your application uses PKCE with the S256 method, which is the default. Search each codebase for direct calls to adapter functions, because those calls fail only when the code path runs.

What should we ask a partner to include in a written quote?

Ask for the named list of applications and libraries in scope, the target Keycloak and library versions, the test scenarios per application including login, silent token renewal, logout and token expiry, and the environments used for testing. Request the deliverables, such as an upgrade runbook, a rollback plan and a test report, along with what is excluded, such as application feature changes or work on the server itself. Confirm how changes after approval are priced and whether ongoing support for later releases is a separate retainer.

Where to confirm the client library changes

Before you plan the application side of a Keycloak upgrade, confirm every client library change against the target release in the Keycloak upgrading guide and the Keycloak JavaScript adapter guide. These two documents are the primary sources. Read the upgrading guide for each release between your current version and the target, not only the final one, because a change that was introduced in an earlier release may still affect applications that skipped it. Record each item that touches a client library, a keycloak-js constructor or method, or an admin client artifact, and note the release where it appeared. Your plan should list those items by application rather than by release, so each team can see which of its code paths are affected.

Check the JavaScript adapter guide for the current defaults your applications will inherit. The guide documents that keycloak-js defaults to PKCE with the S256 method, so any application that relied on an older flow or on implicit behavior must be tested against that default before cutover. Confirm the exact keycloak-js version you will pin in each application, since the server and adapter releases can differ, and confirm that the adapter's documented instantiation and promise handling match what your code uses. Where the guides do not answer a question for your setup, such as a custom login flow or a non-standard redirect, put it on the list to confirm with the Keycloak project or in a proof of concept on a non-production realm before the plan is approved.

How DeployOpen scopes and delivers a Keycloak client library upgrade

DeployOpen plans, implements, tests and documents the application side of a Keycloak upgrade inside your own infrastructure. We sequence keycloak-js and client library changes behind the server upgrade, then verify token handling and logout in each application before handover.

How we scope

  • We inventory every application using keycloak-js, admin client artifacts or other Keycloak client libraries, with current versions and owners.
  • The written scope names which applications, libraries and login flows are covered, and which Keycloak server version the work targets.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts, and a quote follows from that scope.

How we build

  • We map each application's breaking API changes, including removed Promise API usage and renamed admin client artifacts, to specific code changes.
  • We sequence work as server first, then adapters, then client libraries, and confirm the order against the Keycloak upgrading guide for your target release.
  • We test token handling, PKCE login, silent renewal and logout in each application against a non-production realm before any production change.

How we hand over

  • You receive a per-application record of library versions, code changes, test cases run and the results of login and logout checks.
  • We document rollback steps for each application so your team can revert a library change without reverting the server upgrade.
  • Handover includes a short walkthrough so your developers can repeat the test plan for the next keycloak-js or client library release.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, so library changes can follow each Keycloak minor release.
  • We can retest affected applications after each Keycloak release that changes client library behavior, as agreed in the written scope.
  • Confirm with us during scoping which support hours, response expectations and retest cadence your retainer would include.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.