What a required action is
A required action is a step a user must finish before their sign-in completes. Keycloak shows it after the user proves who they are and before it sends them back to the app. Until they finish it, they do not get tokens.
Typical examples are choosing a new password after an admin set a temporary one, verifying an email address, or setting up one-time codes. The user sees a Keycloak page for the step, and the app does not have to build any of it.
In production, required actions are how you roll out a security change to existing users without a big-bang migration. Mark the users, and each one completes the step at their next sign-in.
How Keycloak 26 handles required actions
Each required action has an alias, such as UPDATE_PASSWORD, which is the value stored on the user. The realm lists its required actions under Authentication, Required actions, where each can be enabled or disabled and some can be set as a default action for new users.
A user’s pending actions are in the requiredActions field of the user. When more than one is pending, Keycloak shows them one after another in the same sign-in.
Three ways an action gets on a user
- An admin sets it, in the console on the user’s details or through the admin API.
- Keycloak adds it itself, for example
UPDATE_PASSWORDwhen an admin sets a temporary password, orVERIFY_PROFILEwhen the user profile requires fields the user lacks. - An app asks for it during sign-in with the
kc_actionparameter. This is an application initiated action: it applies to that sign-in only.
Asking for an action from the app
An app sends the user to the normal authorization endpoint with one extra parameter. Keycloak shows the action, then returns to the app’s redirect URI as usual.
https://auth.example.com/realms/acme/protocol/openid-connect/auth
?client_id=web-app
&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
&response_type=code
&scope=openid
&kc_action=UPDATE_PASSWORDNot every action can be started this way, and the alias must be spelled exactly. Test each kc_action link with a test user before you rely on it.
The built-in actions
| Alias | What the user sees |
|---|---|
UPDATE_PASSWORD | A form to choose a new password, checked against the password policy. |
CONFIGURE_TOTP | A QR code for an authenticator app and a code to confirm it. |
VERIFY_EMAIL | A notice that a verification link was emailed. |
UPDATE_PROFILE | A form with their profile fields. |
VERIFY_PROFILE | A form for required profile fields they are missing. |
TERMS_AND_CONDITIONS | The terms, with accept and decline. |
webauthn-register | A prompt to register a security key or passkey as a second factor. |
webauthn-register-passwordless | A prompt to register a passkey for passwordless sign-in. |
CONFIGURE_RECOVERY_AUTHN_CODES | A list of recovery codes to save. |
delete_account | A confirmation to delete their own account. |
delete_credential | A confirmation to remove one of their credentials. |
update_user_locale | Nothing visible: it saves the language they picked. |
UPDATE_EMAIL | A form to change their email address. |
Aliases are case-sensitive and not all in capitals. delete_account and webauthn-register are written exactly as shown.
Some actions depend on features or settings. Terms and Conditions and Delete Account are off by default. Recovery codes and Update Email sit behind feature flags in versions where they are not yet on by default. Check the Required actions tab of your realm for what your version offers.
What this tool does
The reference lists the built-in actions with their aliases, what the user sees and when to use each. A filter finds one by alias or by what it does.
Next to the list, it builds three things for the action you pick: an authorization URL with kc_action for your client, the admin API call that sets the action on a user, and the call that emails the user a link to complete it.
What it does not do
It does not check whether your realm has an action enabled, or whether your version supports starting it with kc_action. It lists built-in actions only, not ones added by extensions. It runs in your browser and sends nothing.
How to use it
- Type a word such as password, otp or email to find the action you need.
- Read what the user will see and when the action fits.
- Enter your server, realm, client id and redirect URI.
- Pick the action and copy the authorization URL, or the admin API call for a user.
- Test the link with a test user before you put it in your app.
Where it pays off
Required actions solve a handful of everyday problems well.
Onboarding imported users
After importing users without passwords, set UPDATE_PASSWORD on each so they choose one at first sign-in. Add UPDATE_PROFILE if the import left out names or other fields.
Rolling out two-factor sign-in
Set CONFIGURE_TOTP or webauthn-register on a group of users. Each one sets up their second factor the next time they sign in, without a separate enrollment page in your app.
After a password leak
Set UPDATE_PASSWORD on the affected users and sign them out everywhere. Their next sign-in forces a new password.
Account settings in your app
A Change password or Set up passkey button in your app can be a kc_action link. Keycloak handles the form and the policy checks.
New terms
Enable TERMS_AND_CONDITIONS and set it on users who must accept a new version. The text comes from the login theme’s messages.
Setting actions through the admin API
Setting an action on a user is an update of the user. Emailing it sends the user a link that runs the actions when they open it.
PUT /admin/realms/acme/users/<user-id>
{"requiredActions": ["UPDATE_PASSWORD"]}
PUT /admin/realms/acme/users/<user-id>/execute-actions-email
["UPDATE_PASSWORD", "VERIFY_EMAIL"]The emailed link needs the realm’s email settings to work. The Admin API request builder writes both calls as curl, with the token step first.
Common problems and fixes
| Problem | Likely cause | Fix |
|---|---|---|
| The action never shows | It is disabled in the realm. | Enable it under Authentication, Required actions. |
A kc_action link does not show the action | The action cannot be started by an app, or the alias is misspelled. | Check the alias, including case. Set it on the user instead. |
| Verify Email does nothing | The realm has no working email settings. | Configure the realm’s email server and send a test message. |
| Delete Account is refused | The user lacks the delete-account role of the account client. | Enable the action and assign that role. |
Security notes
- Required actions run after the user signs in. They do not replace a second factor in the sign-in flow itself.
- An emailed action link works for anyone who has the email. Keep its lifespan short with the admin-initiated action lifespan on the realm’s Tokens tab.
- Temporary passwords set by an admin should always come with
UPDATE_PASSWORD, which the console adds for you. - Turn on Delete Account only if you have a process for what happens to the user’s data in your own systems.
Best practices
- Prefer setting actions on users for one-time changes, and
kc_actionfor things users start themselves. - Keep
update_user_localeenabled when the realm offers more than one language. - Test each action with a test user in a staging realm before you set it on real users.
- When you set actions in bulk, do it in batches and watch login events for errors.