When using "onEvent" method in my custom EventListenerProvider, I need to set attribute "isAfterFirstLogin" to "true", but only get exception: java.lang.IllegalStateException: Cannot access delegate without a transaction
I was trying to use KeycloakTransactionManager transactionManager = session.getTransactionManager(); transactionManager.begin(); transactionManager.commit(); and KeycloakModelUtils.runJobInTransaction
but didn't succeed (the same exception). Fetching the attributes map, and manually putting the attribute won't help, as the change won't be persisted and will be reset after user's session is closed.
Is there any workaround for the issue or any other way how it can be handled?
Keycloak version: 23.0.5
For me the followin works to set an Attribute