mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
# Description of Changes Refactor frontend auth to the shared folder and hook it up to both the portal and editor so they share the same system. Also adds various tasks to help run the portal, including `task dev:portal` to spawn the portal with the backend, and `task dev:portal:proxy` to spawn the editor, portal and backend, and a reverse proxy (at localhost:3000) to allow you to use both at once to simulate how this will actually be deployed, allowing you to check whether the seamless transition between the two actually works.
35 lines
1022 B
TypeScript
35 lines
1022 B
TypeScript
/**
|
|
* Helper utilities for clearing cached OAuth redirect/session state
|
|
*/
|
|
|
|
const OAUTH_REDIRECT_COOKIE = "stirling_redirect_path";
|
|
|
|
/**
|
|
* Clear any persisted OAuth redirect path/cached state so the app
|
|
* does not automatically resume a previous OAuth session after logout.
|
|
*/
|
|
export function resetOAuthState(): void {
|
|
try {
|
|
// Remove redirect cookie
|
|
if (typeof document !== "undefined") {
|
|
document.cookie = `${OAUTH_REDIRECT_COOKIE}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;SameSite=Lax`;
|
|
}
|
|
} catch (err) {
|
|
console.warn("[OAuthStorage] Failed to clear redirect cookie", err);
|
|
}
|
|
|
|
// Remove any related localStorage entries we might have used
|
|
try {
|
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
window.localStorage.removeItem(OAUTH_REDIRECT_COOKIE);
|
|
window.localStorage.removeItem("oauth_redirect_path");
|
|
}
|
|
} catch (err) {
|
|
console.warn("[OAuthStorage] Failed to clear OAuth localStorage", err);
|
|
}
|
|
}
|
|
|
|
export default {
|
|
resetOAuthState,
|
|
};
|