Skip to content

Commit b1f56aa

Browse files
authored
Merge pull request #109 from cesmii/main
Main -> develop - Azure AD login loop fix
2 parents 99b0056 + a5cde76 commit b1f56aa

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

frontend/public/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<meta name="theme-color" content="#000000" />
77
<meta name="description"
88
content="The Profile Designer allows disparate manufacturers and engineers to build manufacturing profiles that could be shared amongst a community of smart manufacturing entities. The profile is a class definition (or collection of class definitions) describing a piece of manufacturing equipment (or conceivably, a manufacturing process or manufactured good). Profiles have relationships to other profiles within the scope of the user's work context. These relationships are of the kinds typically seen in a UML (Unified Modeling Language) diagram, including inheritance, aggregation (or composition), interface implementation, and dependency." />
9+
<meta http-equiv="Cache-Control" content="max-age: 3600, no-cache, no-store, must-revalidate">
10+
<meta http-equiv="Pragma" content="no-cache">
911
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
1012
<link rel="icon" href="%PUBLIC_URL%/favicon.png" sizes="32x32">
1113
<link rel="icon" href="%PUBLIC_URL%/CESMII-Icon-192x192.png" sizes="192x192">

frontend/src/components/OnLoginHandler.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,21 @@ export const handleMSALEvent = (message, setLoadingProps) => {
361361
prompt: 'select_account' //always present the account selection - even if already logged in cached.
362362
};
363363

364-
Msal_Instance.acquireTokenRedirect(loginRequest);
365364
console.error(generateLogMessageString(`handleMSALEvent||${message.eventType}||${message.error}`, CLASS_NAME));
365+
366+
//if it is a token failure AND the interaction mode is silent, it will go into a
367+
//loop of trying to login, failing, trying to login, failing, etc.
368+
//it seems to happen when the access token expires and then the site cannot get a
369+
//refresh token from the server.
370+
//break the cycle by forcing a logout, then starting fresh.
371+
if (message.interactionType === InteractionType.Silent) {
372+
forceLogout(instance);
373+
//instance.loginRedirect(loginRequest);
374+
}
375+
else {
376+
instance.acquireTokenRedirect(loginRequest);
377+
}
378+
366379
}
367380
else {
368381
handleLoginError(message.error, setLoadingProps);

0 commit comments

Comments
 (0)