This is the documentation for v8, checkout the latest version
Keycloakify
HomeGitHubStartersStorybookDiscordKeycloak-js Alternative
v8
  • Keycloakify
  • Release Notes & Upgrade Instructions
  • FAQ
v8
  • 👨‍💻Quick start
  • 🔩Keycloakify in my App
  • 📧Email customization
  • ✒️Terms and conditions
  • ✅Realtime input validation and custom registration fields
  • ⚠️Limitations
  • 🔧Environnement Variables
  • 🌎i18n: msg(...)
  • 📖Build options
  • 💂Email domain acceptlist
  • 🛑Keycloak error in log
  • 🌉Context persistence
  • 💟Contributing
  • 🤔How it works
  • ⬆️Migration guides
    • ⬆️v7 -> v8
    • ⬆️v6 -> v7
    • ⬆️v6.x -> v6.12
    • ⬆️v5 -> v6
Powered by GitBook
On this page
  • package.json options
  • extraThemeProperties
  • bundler
  • groupId
  • artifactId
  • keycloakVersionDefaultAssets
  • version
  • customUserAttributes
  • themeName
  • extraThemeNames
  • areAppAndKeycloakServerSharingSameDomain (deprecated)
  • CLI options
  • --silent

Was this helpful?

Build options

Previousi18n: msg(...)NextEmail domain acceptlist

Last updated 27 days ago

Was this helpful?

package.json options

You can read the package.json fields that are used by Keyclaokify.

extraThemeProperties

By default the theme.properties files located in build_keycloak/src/main/resources/theme/<your app>/login/theme.properties only contains:

parent=keycloak

If, for some reason, you need to add extra properties like for example env=dev you can do it by editing your package.json this way:

package.json
{
    "keycloakify": {
        "extraThemeProperties": [ 
            "env=dev",
            "locales=en,ko",
            "foo=bar",
            "myValue=${env.MY_ENV_VARIABLE:default}"
        ]
    }
}

You can then access this property in the kcContext (kcContext.properties.foo === "bar") even if you won't have type safety.

bundler

Introduced in 6.11.4

Configure if you want Keycloakify to build the final .jar for you or not.

package.json
{
    "keycloakify": {
        "bundler": "none"
    }
}

Possibles values are:

  • "keycloakify" (default): Keycloakify will build the .jar file.

  • "none": Keycloakify will not create a .jar file.

You can also convigure this value using an environement variable:

KEYCLOAKIFY_BUNDLER=none npx keycloakify

groupId

Introduced in 6.11

Configure the groupId that will appear in the pom.xml file.

package.json
{
    "keycloakify": {
        "groupId": "dev.keycloakify.demo-app-advanced.keycloak"
    }
}

By default it's the package.json hompage field at reverse with .keycloak at the end.

You can overwrite this using an environement variable:

KEYCLOAKIFY_GROUP_ID="com.your-company.your-project.keycloak" npx keycloakify

artifactId

Introduced in 6.11

Configure the artifactId that will appear in the pom.xml file.

package.json
{
    "keycloakify": {
        "artifactId": "keycloakify-advanced-starter-keycloak-theme"
    }
}

You can overwrite this using an environement variable:

KEYCLOAKIFY_ARTIFACT_ID="my-cool-theme" npx keycloakify

keycloakVersionDefaultAssets

Default: 11.0.3

package.json
{
    "keycloakify": {
        "keycloakVersionDefaultAssets": "21.0.1"
    }
}

version

Configure the version that will appear in the pom.xml file.

By default the version that is used is the one in the package.json of your project

package.json
{
    "version": "1.3.4"
}

But you can overwrite this value using an environnement variable (Introduced in 6.11):

KEYCLOAKIFY_THEME_VERSION="4.5.6" npx keycloakify

customUserAttributes

Deprecated.

Introduced in 7.4.0 removed in 7.13.0

Keycloakify now analyzes your code and see what field name are actually used. Just make sure your fieldNames aren't generated at runtime. Eg:

// OK ✅
messagesPerField.exists("foo-bar")

// Not OK 🛑
const bar= "bar";
messagesPerField.exists(`foo-${bar}`);

themeName

Introduced in 7.5.0

This is the name of the theme in the Keycloak admin select:

By default it's package.json["name"]

package.json
{
    "keycloakify": {
        "themeName": "my-custom-name"
    }
}

extraThemeNames

Introduced in 7.12

This option let you pack multiple themes variant in a single .jar bundle. In vanilla Keycloak themes you have the ability to extend a base theme. There is now an idiomatic way of achieving the same result by using this option.

package.json
{
    "keycloakify": {
        "extraThemeNames": [ 
            "keycloakify-starter-variant-1", 
            "keycloakify-starter-variant-2"
        ]
    }
}

This will make the theme variant appear in the Keycloak admin select input:

The theme name will be available on the kcContext:

You'll be able to implement different behaviour based on which theme variant is active:

areAppAndKeycloakServerSharingSameDomain (deprecated)

Set to true it tels Keycloakify that you have configured your reverse proxy so that your app and your Keycloak server are under the same domain, example:

  • https://example.com/auth: Keycloak.

  • https://example.com (or https://example.com/x/y/z): Your App

Example:

package.json
{
    "keycloakify": {
        "areAppAndKeycloakServerSharingSameDomain": true
    }
}

When enabled you don't need to specify a homepage field in the package.json

CLI options

Options that can be passed to the npx keycloakify command.

--silent

Prevent the build command from generating outputs.

If you want to have your custom properties listed on the kcContext (at the type level) you can augment the KcContext type definition. .

You can also use it to access Keycloak environment variables in your theme. . You can find a practical example of environment variables.

"mvn" (legacy): Keycloakify will use Maven to bundle the .jar file. This option is to use only if you experience problem with "keycloakify". It require mvn to be installed. If you have to resort to this option so we can see wha't wrong with our way of building the .jar file.

By default it's <themeName>-keycloak-theme See, option.

The artifactId also affects .

Only use this param if you know what you are doing. .

The version also affects .

.

This option is only considered when building with .

📖
here
More info
More info
here
please open an issue about it
keycloak.themeName
the name of the .jar file
See related issue
the name of the .jar file
See issue for more context
--external-assets
Cloud IAM - Keycloak Identity and Access Management as a Service
Feeling overwhelmed? Check out our exclusive sponsor's Cloud IAM consulting services to simplify your experience.
Logo