How do I pre-enable an event listener provider in realms using kc.sh?

My event listener successfully builds, installs and works in Keycloak. But I currently have to manually go into the admin UI to enable it on new installations:

Is there any way I can provide the list of pre-enabled listeners for my Keycloak installs?

I had originally thought something like this:

/opt/keycloak/bin/kc.sh build \
    --verbose \
    --spi-events-listener-[my-listener-name-here]-enabled=true

But that doesn’t seem to be working…

Question on github Discussions.

No. You need to enable it specifically for each realm you want to run it in. You can do it by API, but there’s no way to set defaults.

Following xgp’s comment, here is an example of how to do it with kcadm:

/opt/keycloak/bin/kcadm.sh update events/config -s 'eventsListeners=["openfga-events-publisher","jboss-logging"]'

1 Like