Activating your Theme in Keycloak

Now that you have your theme as a .jar file, let's see how you can import it in Keycloak so that it appears in the dropdown list for selecting a theme in the Keycloak Admin console.

To configure your Theme in the Keycloak server follow the specific instruction depending on the way your Keycloak is deployed

Takes the following instructions with a grain of salt. They are contributed by the comunity and might not be up to date. They'll give you an idea of how it's suposed to be done but you'd be better of looking for the official documentation on how to load keycloak extentions.

cd ~/github
git clone https://github.com/keycloakify/keycloakify-starter
cd keycloakify-starter
# Just to make sure these instructions remain relevant in the future
# We pin the version of the starter we are using.  
git checkout c6511feee3d9471f6ea67bc5176e28150ab951ef
yarn
yarn build-keycloak-theme

docker run \
    -p 8080:8080 \
    --name my-keycloak \
    -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
    -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
    -v "./dist_keycloak/keycloak-theme-for-kc-all-other-versions.jar":/opt/keycloak/providers/keycloak-theme.jar \
    quay.io/keycloak/keycloak:26.0.4 \
    start-dev

Here we use "start-dev" but in production use "start --optimized"

Enabeling globally on your realm

In any scenario, you should never use the Keycloak reserved realm (master) for your application. Instead it is recommended to create one.

The first option is to enable your themes at the realm level, which means that every application that uses this realm will get this theme applied.

  • Select your realm at the top left corner

  • -> Realm settings

  • -> "Themes" tab

Here you'll be able to select your login, account and email theme.

Enabling a theme for a specific client

The login theme can be applied at the client level. You typically have one Keycloak client per web application. Setting the login theme at the client level means that each application of your realm can have different login/register pages. This comes in handy if you're implementing Theme Variants.

To enable a login theme on one of your clients:

  • Select your realm in the top left corner

  • -> Clients

  • -> Select your client in the list

  • -> Scroll down to "Login Theme" and select your theme.

The account theme can only be enabled at the realm level; however, accessing the account pages requires authentication. If you don't want your user to inadvertently come across the default login theme when navigating to the account pages after their session has expired, you might want to enable your login theme on the "account-console" client.

  • Select your realm in the top left corner

  • -> Clients

  • -> Select "account console"

  • -> Scroll down to "Login Theme" and select one of your login theme.

Last updated