Skip to content

Keycloak event types reference

The login event types and admin event operation and resource types Keycloak records, and what each one means.

Runs in your browser. Nothing you paste is sent to us.

Event types

LOGIN
A user signed in.Sign-in · failure: LOGIN_ERROR
LOGOUT
A user signed out or their session was ended.Sign-in · failure: LOGOUT_ERROR
REGISTER
A user registered through the registration form.Sign-in · failure: REGISTER_ERROR
CODE_TO_TOKEN
An app exchanged an authorization code for tokens.Tokens · failure: CODE_TO_TOKEN_ERROR
REFRESH_TOKEN
An app used a refresh token to get new tokens.Tokens · failure: REFRESH_TOKEN_ERROR
CLIENT_LOGIN
A client got a token for itself (client credentials grant).Tokens · failure: CLIENT_LOGIN_ERROR
INTROSPECT_TOKEN
A token was checked at the introspection endpoint.Tokens · failure: INTROSPECT_TOKEN_ERROR
TOKEN_EXCHANGE
A token was exchanged for another (token exchange).Tokens · failure: TOKEN_EXCHANGE_ERROR
PERMISSION_TOKEN
A permission (UMA) token was issued for authorization services.Tokens · failure: PERMISSION_TOKEN_ERROR
USER_INFO_REQUEST
An app read the UserInfo endpoint.Tokens · failure: USER_INFO_REQUEST_ERROR
AUTHREQID_TO_TOKEN
A backchannel (CIBA) request was exchanged for tokens.Tokens · failure: AUTHREQID_TO_TOKEN_ERROR
OAUTH2_DEVICE_AUTH
A device asked for a device code.Device flow · failure: OAUTH2_DEVICE_AUTH_ERROR
OAUTH2_DEVICE_VERIFY_USER_CODE
A user entered the code shown on a device.Device flow · failure: OAUTH2_DEVICE_VERIFY_USER_CODE_ERROR
OAUTH2_DEVICE_CODE_TO_TOKEN
A device exchanged its device code for tokens.Device flow · failure: OAUTH2_DEVICE_CODE_TO_TOKEN_ERROR
PUSHED_AUTHORIZATION_REQUEST
An app pushed an authorization request (PAR).Tokens · failure: PUSHED_AUTHORIZATION_REQUEST_ERROR
UPDATE_PASSWORD
A user changed their password.Account · failure: UPDATE_PASSWORD_ERROR
UPDATE_PROFILE
A user changed their profile.Account · failure: UPDATE_PROFILE_ERROR
UPDATE_EMAIL
A user changed their email address.Account · failure: UPDATE_EMAIL_ERROR
UPDATE_TOTP
A user set up an OTP authenticator.Account · failure: UPDATE_TOTP_ERROR
REMOVE_TOTP
A user removed an OTP authenticator.Account · failure: REMOVE_TOTP_ERROR
VERIFY_EMAIL
A user confirmed their email address.Account · failure: VERIFY_EMAIL_ERROR
VERIFY_PROFILE
A user completed missing profile fields.Account · failure: VERIFY_PROFILE_ERROR
DELETE_ACCOUNT
A user deleted their own account.Account · failure: DELETE_ACCOUNT_ERROR
GRANT_CONSENT
A user gave consent to an app.Account · failure: GRANT_CONSENT_ERROR
UPDATE_CONSENT
A user’s consent to an app changed.Account · failure: UPDATE_CONSENT_ERROR
REVOKE_GRANT
A user’s consent to an app was revoked.Account · failure: REVOKE_GRANT_ERROR
SEND_VERIFY_EMAIL
Keycloak sent an email verification link.Email · failure: SEND_VERIFY_EMAIL_ERROR
SEND_RESET_PASSWORD
Keycloak sent a password reset link.Email · failure: SEND_RESET_PASSWORD_ERROR
SEND_IDENTITY_PROVIDER_LINK
Keycloak sent a link to connect an identity provider account.Email · failure: SEND_IDENTITY_PROVIDER_LINK_ERROR
RESET_PASSWORD
A user reset their password through the forgot password flow.Email · failure: RESET_PASSWORD_ERROR
EXECUTE_ACTIONS
An admin emailed a user required actions.Email · failure: EXECUTE_ACTIONS_ERROR
EXECUTE_ACTION_TOKEN
A user opened an action link from an email.Email · failure: EXECUTE_ACTION_TOKEN_ERROR
CUSTOM_REQUIRED_ACTION
A user completed a required action.Account · failure: CUSTOM_REQUIRED_ACTION_ERROR
RESTART_AUTHENTICATION
A sign-in was started over, for example after a timeout.Sign-in · failure: RESTART_AUTHENTICATION_ERROR
IMPERSONATE
An admin impersonated a user.Admin · failure: IMPERSONATE_ERROR
IDENTITY_PROVIDER_LOGIN
A user signed in through an identity provider.Identity providers · failure: IDENTITY_PROVIDER_LOGIN_ERROR
IDENTITY_PROVIDER_FIRST_LOGIN
A user came from an identity provider for the first time.Identity providers · failure: IDENTITY_PROVIDER_FIRST_LOGIN_ERROR
IDENTITY_PROVIDER_POST_LOGIN
The post login flow ran after an identity provider sign-in.Identity providers · failure: IDENTITY_PROVIDER_POST_LOGIN_ERROR
IDENTITY_PROVIDER_LINK_ACCOUNT
An identity provider account was linked to an existing user.Identity providers · failure: IDENTITY_PROVIDER_LINK_ACCOUNT_ERROR
IDENTITY_PROVIDER_RESPONSE
Keycloak received a response from an identity provider.Identity providers · failure: IDENTITY_PROVIDER_RESPONSE_ERROR
IDENTITY_PROVIDER_RETRIEVE_TOKEN
An app read the stored identity provider token.Identity providers · failure: IDENTITY_PROVIDER_RETRIEVE_TOKEN_ERROR
FEDERATED_IDENTITY_LINK
An identity provider link was added to a user.Identity providers · failure: FEDERATED_IDENTITY_LINK_ERROR
REMOVE_FEDERATED_IDENTITY
An identity provider link was removed from a user.Identity providers · failure: REMOVE_FEDERATED_IDENTITY_ERROR
CLIENT_INITIATED_ACCOUNT_LINKING
An app started linking an identity provider account.Identity providers · failure: CLIENT_INITIATED_ACCOUNT_LINKING_ERROR
CLIENT_REGISTER
A client was created through dynamic client registration.Clients · failure: CLIENT_REGISTER_ERROR
CLIENT_INFO
A client was read through the registration service.Clients · failure: CLIENT_INFO_ERROR
CLIENT_UPDATE
A client was changed through the registration service.Clients · failure: CLIENT_UPDATE_ERROR
CLIENT_DELETE
A client was deleted through the registration service.Clients · failure: CLIENT_DELETE_ERROR
REGISTER_NODE
A cluster node registered with a client.Clients · failure: REGISTER_NODE_ERROR
UNREGISTER_NODE
A cluster node unregistered from a client.Clients · failure: UNREGISTER_NODE_ERROR
INVALID_SIGNATURE
A signed request from a client did not verify.Clients · failure: INVALID_SIGNATURE_ERROR

Recording events

Login events
Keycloak records login events only when saving is on: Realm settings, Events, User events settings. Each event has a type, time, client, user, IP address and details; failures carry an error code, such as invalid_user_credentials on LOGIN_ERROR.
Admin events
Admin events record changes made in the admin console or the admin API, as an operation on a resource type with the resource path. Turn on Include representation to keep the JSON of each change.
Saved events stay in the database until their expiration. Set one, or the event tables keep growing.

51 login types 33 resource types

This lists the common built-in types. Your version may record a few more; the admin console’s event type list for your realm is the full one.

How to use it

  1. Choose login events or admin events.
  2. Search by type or by a word, such as token or email.
  3. Read what each type means; failures add _ERROR to the type.

What to know

Login events record what users and apps do: sign-ins, token requests, profile changes, emails sent. A failed step is recorded as the same type with _ERROR at the end and an error code, such as LOGIN_ERROR with invalid_user_credentials.

Admin events record changes made through the admin console or the admin API, as an operation (create, update, delete, action) on a resource type such as USER or CLIENT.

Both are off until you turn saving on per realm, and saved events stay until their expiration. Set one so the event tables do not keep growing.

What Keycloak events are

Keycloak can record what happens in a realm as events. There are two kinds. Login events, also called user events, record what users and apps do: sign-ins, token requests, profile changes, emails sent. Admin events record changes administrators make to the realm, in the admin console or through the admin API.

Events answer the questions that come up in production. Who signed in, from where, and when? Why did a sign-in fail? Who changed this client’s redirect URIs last week? Without events, those answers are gone.

Every event has a type. Knowing the types is what turns a long list of records into something you can search, alert on and explain to an auditor.

How Keycloak 26 records events

Saving is off by default for both kinds. You turn it on per realm under Realm settings, Events. Once on, events are stored in the Keycloak database and appear under Events in the admin console. They can also be read through the admin API.

Login events

A login event has a type, a time, the realm, the client, the user, the IP address and a set of details. When a step fails, Keycloak records the same type with _ERROR at the end and an error code. A wrong password, for example, is a LOGIN_ERROR with the error invalid_user_credentials.

You can choose which types are saved. Saving fewer types keeps the tables smaller; saving the error types is usually the part worth keeping.

Admin events

An admin event has an operation type, a resource type, the resource path and who made the change. The operation is one of CREATE, UPDATE, DELETE or ACTION. The resource type says what was changed, such as USER, CLIENT or REALM_ROLE_MAPPING.

With Include representation turned on, each admin event also keeps the JSON of the change. That makes events far more useful for audits, but the JSON can contain personal data.

Expiration

Saved events stay in the database until their expiration. Set an expiration for each kind, or the event tables keep growing for as long as the realm exists.

Reading events through the admin API

Both kinds can be queried with filters, which is how most teams feed them into their own tools.

Failed sign-ins, and deleted users, in the sample realm acme
GET /admin/realms/acme/events?type=LOGIN_ERROR&max=50
GET /admin/realms/acme/admin-events?operationTypes=DELETE&resourceTypes=USER

The caller needs the view-events role of the realm-management client. The Admin API request builder shows how to get a token for these calls.

What this tool does

The reference lists the common built-in login event types with what each means, grouped by area: sign-in, tokens, device flow, account, email, identity providers, clients and admin. Each entry shows its _ERROR twin.

For admin events it lists the four operation types and the resource types, each with a short meaning. A search box finds a type by its id or by a word such as token or email. Searching for an _ERROR type finds its base type.

What it does not do

It does not read your realm’s events or connect to your server. It lists common built-in types, not every one; your version may record a few more, and extensions can add their own. The list of event types on your realm’s Events settings is the complete one for your server.

How to use it

  1. Choose Login events or Admin events.
  2. Search by type, for example CODE_TO_TOKEN, or by a word such as refresh.
  3. Read what the type means and which area it belongs to.
  4. Use the type in an event filter, an admin API query or an alert rule.

Event types worth knowing first

TypeWhy it matters
LOGIN and LOGIN_ERROREvery sign-in and every failed one. The base of most dashboards and alerts.
CODE_TO_TOKEN_ERRORAn app failed to exchange its code. Often a redirect URI, PKCE or client secret problem.
REFRESH_TOKEN_ERRORRefresh failed, often because the session ended. Spikes can follow a timeout change.
CLIENT_LOGINA service account got a token. Useful to see which jobs call your APIs.
UPDATE_PASSWORDA user changed their password. Worth watching after an incident.
SEND_RESET_PASSWORDA reset email was sent. Many in a short time can mean someone is probing accounts.
IDENTITY_PROVIDER_LOGINA sign-in through Google, a SAML provider or another identity provider.
IMPERSONATEAn admin acted as a user. Every one should be explainable.

Where it pays off

Events help most when something goes wrong, and when someone asks what happened.

Debugging sign-in problems

When a user says they cannot sign in, filter login events by their username. The error code on the failed event usually says why: wrong password, disabled account, expired code or invalid redirect URI.

Audits

Admin events with representations show who changed what and when. For an audit, that is the record of every change to clients, roles and users made through the console or the API.

After an upgrade or migration

Watch LOGIN_ERROR, CODE_TO_TOKEN_ERROR and REFRESH_TOKEN_ERROR for the first hours after moving a realm or upgrading Keycloak. A rise points at a client, a redirect URI or a secret that did not come across.

Detecting attacks

Many LOGIN_ERROR events for different users from one address suggest password spraying. Many for one user suggest guessing, which brute force detection is there to slow down.

Common problems and fixes

ProblemCauseFix
The Events page is emptySaving is off.Turn on saving under Realm settings, Events.
Only some types appearSaving is limited to selected types.Add the types you need to the saved list.
Admin events have no detailsInclude representation is off.Turn it on for admin events.
The database keeps growingNo expiration is set.Set an expiration for login and admin events.
403 when reading events through the APIThe token lacks the role.Assign view-events of the realm-management client.

Security and privacy notes

  • Login events hold IP addresses and usernames. Treat them as personal data, with a retention period you can explain.
  • Admin event representations can include user details. Turn them on only if you need them, and limit who can read events.
  • Events stored in the database are only as safe as the database and its backups.
  • Event listeners can send events elsewhere, such as to a log pipeline. Keep their output protected like the events themselves.

Best practices

  • Turn on saving for both kinds before you go live, not after the first incident.
  • Save error types even if you skip some success types.
  • Set an expiration that matches your retention policy.
  • Alert on unusual rates of LOGIN_ERROR, SEND_RESET_PASSWORD and IMPERSONATE.
  • Review admin events after every change window.
Questions

Frequently asked questions

How do I enable events in Keycloak?

Open the realm, go to Realm settings, Events, and turn on saving for user events and admin events. Choose which login event types to save and set an expiration for each kind.

How do I see failed logins in Keycloak?

With user events saved, open Events in the admin console and filter by `LOGIN_ERROR`. The error field says why each one failed, such as `invalid_user_credentials` or `user_not_found`.

What is the difference between login events and admin events?

Login events record what users and apps do with the realm, such as signing in or refreshing tokens. Admin events record changes administrators make to the realm through the console or the admin API.

What does LOGIN_ERROR mean in Keycloak?

A sign-in attempt failed. The event’s error code gives the reason, such as a wrong password, an unknown user or a disabled account. It is recorded only when user events are saved.

What does CODE_TO_TOKEN mean?

An app exchanged an authorization code for tokens at the token endpoint. `CODE_TO_TOKEN_ERROR` means that exchange failed, often because of a redirect URI mismatch, a missing PKCE verifier or a wrong client secret.

Why do I see many REFRESH_TOKEN_ERROR events?

Apps tried to refresh tokens for sessions that had already ended, often after an idle timeout or a sign-out. A sudden rise after a change to session timeouts is expected. If it stays high, check that the app sends users to sign in again instead of retrying the refresh.

How long does Keycloak keep events?

Until their expiration. If you set none, they stay in the database. Set an expiration for login events and admin events under Realm settings, Events.

Can I read Keycloak events through the API?

Yes. `GET /admin/realms/<realm>/events` returns login events and `GET /admin/realms/<realm>/admin-events` returns admin events, both with filters. The caller needs the `view-events` role of `realm-management`.

Who changed a client in Keycloak?

Admin events record it if they were saved at the time. Filter admin events by resource type `CLIENT` and look at the user and time on each `UPDATE`. With representations on, you also see what changed.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.