8000 fix: return OAuth error codes in authorization endpoint JSON responses by atiqur-rahman-pro · Pull Request #54194 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

fix: return OAuth error codes in authorization endpoint JSON responses - #54194

Merged
mposolda merged 3 commits into
keycloak:mainfrom
atiqur-rahman-pro:fix/authorization-json-errors-54134
Nov 2, 2026
Merged

mposolda merged 3 commits into
keycloak:mainfrom
atiqur-rahman-pro:fix/authorization-json-errors-54134

Conversation

@atiqur-rahman-pro
Copy link
Copy Markdown
Contributor

Fixes #54134

Authorization endpoint JSON errors currently put localized message text in error. Return an OAuth error code in error and the localized message in error_description so clients can handle failures reliably.

Preserves existing HTTP statuses, HTML responses, validated redirects, and direct-grant error formatting. Includes upgrade documentation and regression coverage for GET/POST requests and localized descriptions.

Fixes keycloak#54134

Signed-off-by: Atiqur Rahman <rahman.atiqur.pro@gmail.com>
@atiqur-rahman-pro
atiqur-rahman-pro requested a review from a team as a code owner October 20, 2026 17:59
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:59
Signed-off-by: Atiqur Rahman <rahman.atiqur.pro@gmail.com>
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A null description for unsupported response types can cause error-page rendering to fail instead of returning the intended response.

1 open issue
What changed in this PR

Addresses #54134 by separating OAuth error codes from human-readable descriptions in authorization endpoint JSON responses.

Changes:

  • Pass explicit OAuth error codes through error-page rendering.
  • Preserve legacy formatting for unrelated JSON errors.
  • Add regression coverage and upgrade guidance.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​oidc/​AuthorizationEndpointJsonErrorTest.java Tests JSON, HTML, localization, redirects, and direct grants.
services/​src/​main/​java/​org/​keycloak/​services/​ErrorPageException.java Adds an OAuth-aware error factory.
services/​src/​main/​java/​org/​keycloak/​protocol/​oidc/​endpoints/​request/​AuthorizationEndpointRequestParserProcessor.java Assigns codes to request parsing errors.
services/​src/​main/​java/​org/​keycloak/​protocol/​oidc/​endpoints/​AuthorizationEndpointChecker.java Separates validation codes and descriptions.
services/​src/​main/​java/​org/​keycloak/​protocol/​oidc/​endpoints/​AuthorizationEndpoint.java Assigns codes to authorization failures.
services/​src/​main/​java/​org/​keycloak/​forms/​login/​freemarker/​FreeMarkerLoginFormsProvider.java Renders separate JSON error fields.
server-spi-private/​src/​main/​java/​org/​keycloak/​forms/​login/​LoginFormsProvider.java Adds a backward-compatible provider overload.
docs/​documentation/​upgrading/​topics/​changes/​changes-27_0_0.adoc Documents the JSON response change.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 20, 2026 18:03
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Null descriptions in unsupported-response-type handling can break error-page rendering instead of returning the intended HTTP 400 response.

1 open issue

Review effort: Balanced

Related to keycloak#54134

Signed-off-by: Atiqur Rahman <rahman.atiqur.pro@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 23:21
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues were identified in the focused implementation and regression coverage; tests were not executed.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@mposolda mposolda self-assigned this Oct 27, 2026
@mposolda mposolda left a comment
Copy link
Copy Markdown
Contributor
8000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atiqur-rahman-pro
Copy link
Copy Markdown
Contributor Author

@rmartinc please can you merge it ?

@mposolda
mposolda merged commit f9e0f8e into keycloak:main Nov 2, 2026
112 of 118 checks passed
ruchikajha95 pushed a commit to ruchikajha95/keycloak that referenced this pull request Nov 3, 2026
keycloak#54194)

Fixes keycloak#54134


Signed-off-by: Atiqur Rahman <rahman.atiqur.pro@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authorization endpoint JSON error responses put message text in error instead of an OAuth error code

3 participants

0