Skip to content

Commit 371068e

Browse files
fix(authentication): code flow (#3)
Signed-off-by: Joris Mancini <[email protected]>
1 parent 7f992f0 commit 371068e

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@emotion/react": "^11.8.2",
1818
"@emotion/styled": "^11.8.1",
19-
"@gridsuite/commons-ui": "^0.43.0",
19+
"@gridsuite/commons-ui": "^0.44.0",
2020
"@hookform/resolvers": "^3.3.1",
2121
"@mui/icons-material": "^5.5.1",
2222
"@mui/lab": "^5.0.0-alpha.75",

src/components/app.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ const App: FunctionComponent = () => {
133133
})
134134
);
135135

136+
const [initialMatchSigninCallbackUrl] = useState(
137+
useMatch({
138+
path: '/sign-in-callback',
139+
})
140+
);
141+
136142
const initialize: () => Promise<UserManager> = useCallback(() => {
137143
if (process.env.REACT_APP_USE_AUTHENTICATION === 'true') {
138144
return fetchAuthorizationCodeFlowFeatureFlag().then(
@@ -142,7 +148,8 @@ const App: FunctionComponent = () => {
142148
initialMatchSilentRenewCallbackUrl != null,
143149
fetch('idpSettings.json'),
144150
fetchValidateUser,
145-
authorizationCodeFlowEnabled
151+
authorizationCodeFlowEnabled,
152+
initialMatchSigninCallbackUrl != null
146153
)
147154
);
148155
} else {
@@ -152,11 +159,16 @@ const App: FunctionComponent = () => {
152159
() =>
153160
new Promise((resolve) =>
154161
window.setTimeout(() => resolve(true), 500)
155-
)
162+
),
163+
initialMatchSigninCallbackUrl != null
156164
);
157165
}
158166
// Note: initialMatchSilentRenewCallbackUrl and dispatch don't change
159-
}, [initialMatchSilentRenewCallbackUrl, dispatch]);
167+
}, [
168+
initialMatchSilentRenewCallbackUrl,
169+
dispatch,
170+
initialMatchSigninCallbackUrl,
171+
]);
160172

161173
useEffect(() => {
162174
initialize()

0 commit comments

Comments
 (0)