fix(auth): oidc-react-issue (#4410)

Co-authored-by: James Petts <jamespetts@Yunu-MacBookPro-JamesPetts.local>
This commit is contained in:
James Petts 2024-10-11 14:09:26 +01:00 committed by GitHub
parent 0495020389
commit e849199eb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -95,7 +95,10 @@ export default function ModeRoute({
await extensionManager.registerExtension(extension);
}
}
setExtensionDependenciesLoaded(true);
if (isMounted.current) {
setExtensionDependenciesLoaded(true);
}
};
loadExtensions();

View File

@ -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);
};
@ -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;