In a Keycloak Docker Container
Last updated
Was this helpful?
Last updated
Was this helpful?
Testing your theme in Storybook is nice, but at some point you'll want to test your theme in a real Keycloak before shipping it in production!
First you want to install and launch (or just Docker) on your computer, if you haven't done it already.
You'll also need Maven to build the .jar locally. Try running mvn --version
to see if you have it already. If you don't install it with:
Using :
You are ready! In your Keycloakify just run:
You'll be invited to chose the Keycloak version you want to spin up:
Keycloakify will preconfigure a realm and client for your theme so you don't necessarily need to go in the the Keycloak admin console you can simply navigate to https://my-theme.keycloakify.dev it will redirect to your local Keycloak login pages!
If you makes changes in your theme while the Keycloak container is running your theme will be automatically recompiled and updated in Keycloak. After a few seconds you'll just have to refresh the page you see them live.
Clicking on the https://my-theme.keycloakify.dev link will redirect you to the login page of your theme:
With the developer tool of your brower you'll be able to explore the kcContext of the page. You can use it to creates new stories of your pages in specific configuration.
Loggin in with the test user (testuser/password123) will redirect you to a page where you'll be able to inspect the decoded id token JWT beside other things.
There are many options available to you to configure the Keycloak testing container.
Configured as the example above, the docker run command will be the following one: