diff --git a/js/apps/admin-ui/src/context/auth/admin-ui-endpoint.ts b/js/apps/admin-ui/src/context/auth/admin-ui-endpoint.ts index 9b298cfcfb..20860f10cb 100644 --- a/js/apps/admin-ui/src/context/auth/admin-ui-endpoint.ts +++ b/js/apps/admin-ui/src/context/auth/admin-ui-endpoint.ts @@ -11,8 +11,12 @@ export async function fetchAdminUI( const baseUrl = adminClient.baseUrl; const response = await fetchWithError( - joinPath(baseUrl, "admin/realms", adminClient.realmName, endpoint) + - (query ? "?" + new URLSearchParams(query) : ""), + joinPath( + baseUrl, + "admin/realms", + encodeURIComponent(adminClient.realmName), + endpoint, + ) + (query ? "?" + new URLSearchParams(query) : ""), { method: "GET", headers: getAuthorizationHeaders(accessToken),