Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The required context breaks documented KeycloakProvider-only consumers, while aborted requests can trigger global errors and empty or non-JSON 401/403 responses incorrectly show generic errors.
3 open issues
What changed in this PR
Improves Account Console permission-error handling for users without manage-account, addressing #40100.
Changes:
- Adds HTTP status to API errors and Forbidden messaging for 401/403 responses.
- Routes asynchronous failures through a shared error boundary.
- Provides Sign out for permission errors and Try again for other failures.
| File | Description |
|---|---|
js/apps/account-ui/src/utils/usePromise.ts |
Sends promise failures to the shared boundary. |
js/apps/account-ui/src/root/ErrorRenderer.tsx |
Adds permission-aware error rendering and actions. |
js/apps/account-ui/src/organizations/Organizations.tsx |
Removes the local error-boundary provider. |
js/apps/account-ui/src/main.tsx |
Installs the application-wide boundary and fallback. |
js/apps/account-ui/src/api/parse-response.ts |
Adds HTTP status to ApiError. |
js/apps/account-ui/maven-resources/theme/keycloak.v3/account/messages/messages_en.properties |
Adds English Forbidden messaging. |
Review effort: Balanced
|
Addressed the Copilot review:
|
There was a problem hiding this comment.
🟡 Changes recommended
Removing the local error-boundary provider causes the exported Organizations page to throw for consumers using only KeycloakProvider, even when API requests succeed.
1 open issue
3 resolved since last review
Review effort: Balanced
| <OrganizationTable | ||
| link={({ children }) => <span>{children}</span>} | ||
| loader={userOrgs} | ||
| > |
|
Follow-up for the Organizations review note: |
| <AlertProvider> | ||
| <Help>{children}</Help> | ||
| </AlertProvider> | ||
| <ErrorBoundaryProvider> |
Wire usePromise through ErrorBoundary like the Admin Console so API failures receive the error, and treat missing account audience/roles as access denied instead of a generic unexpected error. Closes keycloak#40100 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Keep usePromise working without ErrorBoundaryProvider, preserve HTTP status on non-JSON 401/403 responses, and ignore aborted requests before reporting errors. Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
Mount the shared error boundary inside KeycloakProvider so exported Account pages and Admin useFetch work with KeycloakProvider alone. Keep app-specific ErrorBoundaryFallback for Forbidden / error UI. Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
15e5ced to
a954020
Compare
| <StrictMode> | ||
| <KeycloakProvider environment={environment}> | ||
| <Root /> | ||
| <ErrorBoundaryFallback fallback={ErrorRenderer}> |
| @@ -1,3 +1,4 @@ | |||
| import { useOptionalErrorBoundary } from "@keycloak/keycloak-ui-shared"; | |||
Use the PF6 Modal subcomponents and Content, and export useOptionalErrorBoundary from ui-shared-pf6 for usePromise. Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The PF6 KeycloakProvider still lacks an error boundary, causing authenticated Account UI loads and exported Organizations components to crash with “No provider found.”
4 open issues
1 resolved since last review
Review effort: Balanced


Closes #40100
Account Console v3 was routing API failures through a router
ErrorPagewithout the error object, so impersonating a user withoutmanage-accountshowed a generic unexpected-error dialog. This restores clearer Forbidden UX and aligns error wiring with the Admin Console.Decisions and assumptions
ErrorBoundaryProvider+usePromise→showBoundary), and dropped that PR'scontent.jsonchange (static theme resource, not Account REST).ApiError.statusand an AccountErrorRendererthat maps HTTP 401/403 to the former v2needAccessRightscopy, with Sign out as the primary action.usePromisewrap the tree inErrorBoundaryProvider, matching Admin ConsoleuseFetch.AI agents were used to help implement this change.