mirror of
https://github.com/outline/outline.git
synced 2026-08-03 13:27:25 +03:00
* Add spec-compliant OIDC logout * Scope OIDC logout token cookie * Assert OIDC post logout redirect * Handle invalid OIDC logout URLs
21 lines
500 B
TypeScript
21 lines
500 B
TypeScript
import { Redirect } from "react-router-dom";
|
|
import env from "~/env";
|
|
import useStores from "~/hooks/useStores";
|
|
import { logoutPath } from "~/utils/routeHelpers";
|
|
|
|
const Logout = () => {
|
|
const { auth } = useStores();
|
|
|
|
void auth.logout({
|
|
userInitiated: true,
|
|
clearCache: true,
|
|
});
|
|
|
|
if (env.OIDC_LOGOUT_URI || auth.lastSignedIn === "oidc") {
|
|
return null; // user will be redirected to logout URI after logout
|
|
}
|
|
return <Redirect to={logoutPath()} />;
|
|
};
|
|
|
|
export default Logout;
|