Repository navigation
Application-initiated actions: kc_action on the challenge endpoint - #41
Merged
Merged
Conversation
A signed-in app can start a required action on request (spec/21), e.g. a password change from its settings. kc_action is copied to Keycloak's kc_action client note, so Keycloak's own rules apply: re-authentication when the action's maximum authentication age has passed (or max_age / prompt=login), the action runs even when nothing is pending, and an unconfigured alias reports error. - Step-up with kc_action within the action's max age and without a higher level skips the flow and goes straight to the action, like a browser's identity cookie (also on flows without LoA conditions). - RequiredActionDriver applies executeAction's checks (initiated-action support, enabled), makes an app-initiated action skippable unless it is also pending on the user, and records kc_action_status under the requested alias (success and skip statuses were recorded under the native id, so substituted actions never reported one). - The 200 body carries kc_action_status (success, cancelled, error). - native-update-password supports application initiation and offers logout_other_sessions, which ends the user's other online and offline sessions but keeps the current one (Keycloak's helper would also end the step-up's own session). - KcActionIT plus transcripts; carol's update_password transcript re-recorded for the new param. spec/21, spec/03 and docs updated.
…the SDKs An SDK always exchanges the code after a 200; the scenarios now sign in the way an app does. The status-free login check moved into the shared sign-in.
- Split alias:parameter into kc_action and kc_action_parameter like AuthorizationEndpoint (delete_credential:<id>, idp_link:<alias>, webauthn-register:skip_if_exists). - An action without a native variant continues through redirect_to_web with kc_action in the stored PAR request, so Keycloak's page runs it and the browser redirect carries kc_action_status (it was dropped, so the action never ran). - native-verify-email, native-configure-pin and native-passkey-register allow application initiation. - KcActionIT: parameter split, VERIFY_EMAIL cancel, UPDATE_PROFILE through the browser with kc_action_status=success on the callback; transcripts. spec/21, spec/03 and docs updated.
xgp
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A signed-in app can start a required action on request — first use: Change password from an app's settings, with the user proving who they are first. Design: spec/21. SDK support follows in a separate PR (spec/21 D6).
How it works.
kc_action=<alias>on the challenge endpoint (usually with the post-loginauth_session, i.e. a step-up) is copied to Keycloak'skc_actionclient note, so Keycloak's own AIA rules apply:maxAuthAge; default 300 s), or when the app sendsmax_age/prompt=login. Operators set the default in the admin console; apps can only make it stricter.acr_values) the step-up skips the flow and goes straight to the action, like a browser's identity cookie. Without this, a flow without LoA conditions would re-run every factor and the realm setting would never apply.executeAction's checks). Today:native-update-password.action=skip) unless the action is also pending on the user.200body carrieskc_action_status:success,cancelledorerror.Sign out other devices.
update_passwordofferslogout_other_sessions(paramtrueas the suggested default; optional answer field, absent =falseso older SDKs behave as before). It ends the user's other online and offline sessions and keeps the current one; Keycloak'sAuthenticatorUtil.logoutOtherSessionswould also end the step-up's own session, so the action has its own implementation.Fix along the way.
RequiredActionDriverrecorded success/skip statuses under the native provider id, so a substituted action (e.g.UPDATE_PASSWORD→native-update-password) never reported akc_action_status.Tests.
KcActionIT(5): change right after login without re-auth + other session ended / own session kept; realmmaxAuthAge(0)forces re-auth;max_age=0+ cancel keeps the password; non-initiatable / unknown actions reporterror; no status withoutkc_action.KcActionIT,RequiredActionsIT,StepUpIT,EnrolOnFirstLoginIT,PinIT— 28 tests pass.KcActionITones added;RequiredActionsIT.carolUpdatesHerPasswordInBandre-recorded (the descriptor gainedlogout_other_sessions). iOS core (125 tests) and Android core replay suites pass against them.Docs: spec/03 (§2.1, §3.1, §4.11, §4.12, §5), spec index,
docs/protocol-and-flows.md(new Application-initiated actions section).