I already create a custom event listener, it have a capability to listen to Login Event. So when a user login, this listener will persist into the user’s attribute the time his/her logged in.
I also build a service use Keycloak Admin client library with Java to retrieve the user data.
The problem is, when i retrieve that user data via the service, it doesn’t show the latest data of the user-attribute.
Let’s say the user A logged in at 11:00 AM. The service show the 11:00 AM. But after user A login again at 11:30 AM, the service show still 11:00 AM.
Is there any configuration or is there a suggestion what best practices to persist this login time via my custom event listener ?
Thank you so much that helped me get what I wanted!
Does anyone know if it’s possible to have a listener “enabled” only for some realms? So I don’t update user attributes on all realms but only where I need to?
I know I can get the user realm from the sessions but I don’t want to hardcode it into the library
Update: Nvm just saw that you need to manually enable the event listener in the realm, neat!