Customizing error messages on KeyCloak's UI

I am trying to change the messages shown in the red/white alert/flash cards that pop-up in KeyCloak’s UI when something goes wrong (or green if it goes right). I am not sure how to do this though. I am pretty new to KeyCloak and it’s proving itself to be a little difficult to understand if I should tinker with the exceptions or if this is an option available when customizing a theme.

Can someone point me in the right direction to achieve this?

Depending on which messages you are talking about, many are stored in properties files in the themes. For example, for the login pages, the English language messages are here: https://github.com/keycloak/keycloak/blob/main/themes/src/main/resources/theme/base/login/messages/messages_en.properties

To override these values, you will need to create a custom theme. You can see more information on implementing your own themes in the Keycloak Server Developer documentation.
https://www.keycloak.org/docs/latest/server_development/index.html#_themes

I have also created a theme template that will make it easier to override those values in the properties files and then deploy the updated theme as a jar.

Hi xgp, thanks for the reply. I’ll take a look at the links you provided. BTW, I meant these kind of messages that pop-up for some seconds when there is any notification:

flash_message

Those are in the admin UI. It is possible, albeit significantly more difficult to override the default admin theme. The source code for that UI is here

and the properties are stored in this directory
https://github.com/keycloak/keycloak-ui/tree/main/apps/admin-ui/public/resources
To override these, you’ll have the follow the instructions in that repo for building and deploying a custom admin UI theme.

Thanks xgp! I’ll check it and see if it’s worth the hassle to go through them, as I guess they cover most of the error messages that I want. Nice to have a post pointing out to this tho.