From 7f825093b3ddf12f50802753d749798ab79c0a8b Mon Sep 17 00:00:00 2001 From: BrownKnight Date: Sat, 31 Aug 2024 11:15:17 +0100 Subject: [PATCH] fix token refresh not working --- ui/src/UserContext.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/UserContext.tsx b/ui/src/UserContext.tsx index 62d2b4c..a69ecc2 100644 --- a/ui/src/UserContext.tsx +++ b/ui/src/UserContext.tsx @@ -44,7 +44,7 @@ export default function UserContextProvider({ children }: React.PropsWithChildre AuthFlow: "REFRESH_TOKEN_AUTH", ClientId: "6q9id5vhqfocb9mc0deep4at49", AuthParameters: { - REFRESH_TOKEN: user?.refreshToken, + REFRESH_TOKEN: user.refreshToken, }, }; @@ -59,9 +59,9 @@ export default function UserContextProvider({ children }: React.PropsWithChildre const json = await res.json(); if (json) { - setUser({ username: user.username, id: user.id, refreshToken: json.RefreshToken, idToken: json.IdToken }); + setUser({ username: user.username, id: user.id, refreshToken: json?.AuthenticationResult?.RefreshToken, idToken: json?.AuthenticationResult?.IdToken }); } - return json.IdToken as string; + return json?.AuthenticationResult?.IdToken as string; }; const onClose = () => {