From 7368104e439015ec764955a381996d93bb75f779 Mon Sep 17 00:00:00 2001 From: vramik Date: Tue, 29 Oct 2024 10:07:31 +0100 Subject: [PATCH] Keep `error` and `error_description` query params in login url. Signed-off-by: vramik --- .../services/resources/account/AccountConsole.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java b/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java index e4391043b8..60221e2a29 100644 --- a/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java +++ b/services/src/main/java/org/keycloak/services/resources/account/AccountConsole.java @@ -247,6 +247,18 @@ public class AccountConsole implements AccountResourceProvider { .queryParam(OAuth2Constants.CODE_CHALLENGE, pkceChallenge) .queryParam(OAuth2Constants.CODE_CHALLENGE_METHOD, OAuth2Constants.PKCE_METHOD_S256); + if (!queryParameters.isEmpty()) { + String error = queryParameters.getFirst(OAuth2Constants.ERROR); + if (error != null) { + uriBuilder.queryParam(OAuth2Constants.ERROR, error); + + String errorDescription = queryParameters.getFirst(OAuth2Constants.ERROR_DESCRIPTION); + if (errorDescription != null) { + uriBuilder.queryParam(OAuth2Constants.ERROR_DESCRIPTION, errorDescription); + } + } + } + URI url = uriBuilder.build(); return Response.status(302).location(url).build();