From 47a8c25c99a9777b250f2af49bbf3f8ced16df01 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 10 Mar 2022 11:46:42 +0100 Subject: [PATCH] Catch 403 when only query-clients is allowed (#2182) --- src/clients/initial-access/InitialAccessTokenList.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/clients/initial-access/InitialAccessTokenList.tsx b/src/clients/initial-access/InitialAccessTokenList.tsx index f54853dac1..0c61453590 100644 --- a/src/clients/initial-access/InitialAccessTokenList.tsx +++ b/src/clients/initial-access/InitialAccessTokenList.tsx @@ -24,8 +24,13 @@ export const InitialAccessTokenList = () => { const [token, setToken] = useState(); - const loader = async () => - await adminClient.realms.getClientsInitialAccess({ realm }); + const loader = async () => { + try { + return await adminClient.realms.getClientsInitialAccess({ realm }); + } catch (error) { + return []; + } + }; const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({ titleKey: "clients:tokenDeleteConfirmTitle",