Keycloak provides an Events SPI that makes it possible to register listeners for user related events, for example user logins.
There are two interfaces that can be implemented, the first is a pure listener, the second is a events store which listens for events, but is also required to store events.
An events store provides a way for the admin and account management consoles to view events.
== Event types
Login events:
* Login - A user has logged in
* Register - A user has registered
* Logout - A user has logged out
* Code to Token - An application/client has exchanged a code for a token
* Refresh Token - An application/client has refreshed a token
Account events:
* Social Link - An account has been linked to a social provider
* Remove Social Link - A social provider has been removed from an account
* Update Email - The email address for an account has changed
* Update Profile - The profile for an account has changed
* Send Password Reset - A password reset email has been sent
* Update Password - The password for an account has changed
* Update TOTP - The TOTP settings for an account has changed
* Remove TOTP - TOTP has been removed from an account
* Send Verify Email - A email verification email has been sent
* Verify Email - The email address for an account has been verified
For all events there is a corresponding error event.
== Event Listener
Keycloak comes with an Email Event Listener and a JBoss Logging Event Listener.
The Email Event Listener sends an email to the users account when an event occurs.
The JBoss Logging Event Listener writes to a log file when an events occurs.
The Email Event Listener only supports the following events at the moment:
* Login Error
* Update Password
* Update TOTP
* Remove TOTP
You can exclude one or more events by editing `standalone/configuration/keycloak-server.json` and adding for example: