Skip to content

Commit

Permalink
fix(auth): oidc-react-issue (#4410)
Browse files Browse the repository at this point in the history
Co-authored-by: James Petts <[email protected]>
  • Loading branch information
JamesAPetts and James Petts authored Oct 11, 2024
1 parent 0495020 commit e849199
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion platform/app/src/routes/Mode/Mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ export default function ModeRoute({
await extensionManager.registerExtension(extension);
}
}
setExtensionDependenciesLoaded(true);

if (isMounted.current) {
setExtensionDependenciesLoaded(true);
}
};

loadExtensions();
Expand Down
8 changes: 5 additions & 3 deletions platform/app/src/utils/OpenIdConnectRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const initUserManager = (oidc, routerBasename) => {
post_logout_redirect_uri: _makeAbsoluteIfNecessary(post_logout_redirect_uri, baseUri),
});

const client = firstOpenIdClient.useAuthorizationCodeFlow ? NextClient: LegacyClient
const client = firstOpenIdClient.useAuthorizationCodeFlow ? NextClient : LegacyClient

return client(openIdConnectConfiguration);
};
Expand Down Expand Up @@ -110,8 +110,10 @@ function OpenIdConnectRoutes({ oidc, routerBasename, userAuthenticationService }
};
};

const handleUnauthenticated = async () => {
await userManager.signinRedirect();
const handleUnauthenticated = () => {
// Note: Don't await the redirect. If you make this component async it
// causes a react error before redirect as it returns a promise of a component rather than a component.
userManager.signinRedirect();

// return null because this is used in a react component
return null;
Expand Down

0 comments on commit e849199

Please sign in to comment.