From 57b8561c3c483a66cacf8109475ce956f7644d64 Mon Sep 17 00:00:00 2001 From: Joris Mancini Date: Thu, 1 Feb 2024 10:56:19 +0100 Subject: [PATCH] fix(authentication): code flow Signed-off-by: Joris Mancini --- package-lock.json | 8 ++++---- package.json | 2 +- src/components/app.tsx | 18 +++++++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 93a1b74..e3abda6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", - "@gridsuite/commons-ui": "^0.43.0", + "@gridsuite/commons-ui": "^0.44.0", "@hookform/resolvers": "^3.3.1", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.75", @@ -2470,9 +2470,9 @@ } }, "node_modules/@gridsuite/commons-ui": { - "version": "0.43.0", - "resolved": "https://registry.npmjs.org/@gridsuite/commons-ui/-/commons-ui-0.43.0.tgz", - "integrity": "sha512-AHJdND94kdrBxXs8NvMtO4vFaBYxWACneq8Tri0msuH1xlxkbmWCeUtbtt71S1x3FDoAHs4dfTuF0g2YLLa0OA==", + "version": "0.44.0", + "resolved": "https://registry.npmjs.org/@gridsuite/commons-ui/-/commons-ui-0.44.0.tgz", + "integrity": "sha512-tIBZHdO/mURDeKz1ttSRtleriKGBebwgL1TekPtzyT/YxHGIORLSpUr8DsbFL+Dxr4VgXNQ+JD4/sJMAnoUDZA==", "dependencies": { "autosuggest-highlight": "^3.2.0", "clsx": "^1.0.4", diff --git a/package.json b/package.json index 91b51d3..478e8fc 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dependencies": { "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", - "@gridsuite/commons-ui": "^0.43.0", + "@gridsuite/commons-ui": "^0.44.0", "@hookform/resolvers": "^3.3.1", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.75", diff --git a/src/components/app.tsx b/src/components/app.tsx index 45fa31e..256a967 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -133,6 +133,12 @@ const App: FunctionComponent = () => { }) ); + const [initialMatchSigninCallbackUrl] = useState( + useMatch({ + path: '/sign-in-callback', + }) + ); + const initialize: () => Promise = useCallback(() => { if (process.env.REACT_APP_USE_AUTHENTICATION === 'true') { return fetchAuthorizationCodeFlowFeatureFlag().then( @@ -142,7 +148,8 @@ const App: FunctionComponent = () => { initialMatchSilentRenewCallbackUrl != null, fetch('idpSettings.json'), fetchValidateUser, - authorizationCodeFlowEnabled + authorizationCodeFlowEnabled, + initialMatchSigninCallbackUrl != null ) ); } else { @@ -152,11 +159,16 @@ const App: FunctionComponent = () => { () => new Promise((resolve) => window.setTimeout(() => resolve(true), 500) - ) + ), + initialMatchSigninCallbackUrl != null ); } // Note: initialMatchSilentRenewCallbackUrl and dispatch don't change - }, [initialMatchSilentRenewCallbackUrl, dispatch]); + }, [ + initialMatchSilentRenewCallbackUrl, + dispatch, + initialMatchSigninCallbackUrl, + ]); useEffect(() => { initialize()