Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: force hitting fusionauth oauth logout endpoint on client (#2083)

Will Hutchinson51cac51575b7
diff --git a/js/app/bun.lock b/js/app/bun.lock
index 53e01033e1..9a42aeaf60 100644
--- a/js/app/bun.lock
+++ b/js/app/bun.lock
@@ -2783,7 +2783,7 @@
"pathval": ["[email protected]", "", {}, "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA=="],
- "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6", "sha512-HDFaPbCxLG2GHpf1smUG97nku5aPGBGaCcIbK05dGdp07TBLUlDcXsM4WcE82mO5W4RBPIBVYobX5N/6M6NFrA=="],
+ "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6"],
"performance-now": ["[email protected]", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],
diff --git a/js/app/packages/app/component/settings/Account.tsx b/js/app/packages/app/component/settings/Account.tsx
index 3e71146c90..1e50c9ff2c 100644
--- a/js/app/packages/app/component/settings/Account.tsx
+++ b/js/app/packages/app/component/settings/Account.tsx
@@ -109,14 +109,12 @@ export function Account() {
};
const logoutHandler = () => {
- let redirectUrl = window.location.origin;
- logout(redirectUrl);
+ logout();
};
const deleteAccountHandler = async () => {
await authServiceClient.deleteUser();
- let redirectUrl = window.location.origin;
- logout(redirectUrl);
+ logout();
};
return (
diff --git a/js/app/packages/core/auth/logout.ts b/js/app/packages/core/auth/logout.ts
index 2ff334d7a8..af9493b68a 100644
--- a/js/app/packages/core/auth/logout.ts
+++ b/js/app/packages/core/auth/logout.ts
@@ -2,6 +2,7 @@ import { withAnalytics } from '@coparse/analytics';
import { authServiceClient } from '@service-auth/client';
import { authKeys } from '@queries/auth/user-info';
import { queryClient } from '@queries/client';
+import { SERVER_HOSTS } from '@core/constant/servers';
import { createCallback } from '@solid-primitives/rootless';
import { useAnalytics } from '@app/component/analytics-context';
@@ -10,7 +11,7 @@ const { track, TrackingEvents } = withAnalytics();
export function useLogout() {
const analytics = useAnalytics();
- return createCallback(async (redirectUrl?: string) => {
+ return createCallback(async () => {
document.cookie =
'login=false; expires=Thu, 01 Jan 1970 00:00:00 UTC; max-age=0; path=/; SameSite=Lax';
@@ -32,6 +33,6 @@ export function useLogout() {
analytics.reset();
track(TrackingEvents.AUTH.LOGOUT);
- if (redirectUrl) window.location.href = redirectUrl;
+ window.location.href = SERVER_HOSTS['auth-logout'];
});
}
diff --git a/js/app/packages/core/constant/servers.ts b/js/app/packages/core/constant/servers.ts
index 8d597238f2..186f5e6b32 100644
--- a/js/app/packages/core/constant/servers.ts
+++ b/js/app/packages/core/constant/servers.ts
@@ -1,5 +1,6 @@
const serverHostLocal: Servers = {
'auth-service': 'http://localhost:8080',
+ 'auth-logout': 'http://localhost:3000', // TODO: make work with local fusionauth later
'pdf-service': 'http://localhost:4567',
'document-storage-service': 'http://localhost:8086',
'websocket-service': 'ws://localhost:6969',
@@ -15,8 +16,14 @@ const serverHostLocal: Servers = {
const devServerSuffix = import.meta.env.MODE === 'development' ? '-dev' : '';
+const authLogoutUrl =
+ import.meta.env.MODE === 'development'
+ ? 'https://fusionauth-dev.macro.com/oauth2/logout?client_id=eb75fe7a-0ef1-4186-96d9-cc62cfb1d10c&tenantId=5e13f524-8d32-0454-81f8-061936256aa4'
+ : 'https://auth.macro.com/oauth2/logout?client_id=75409999-7dc4-4241-b73b-a51818c3a71c&tenantId=a3e53c3d-8d6a-3e92-d64c-fa3bf30a60be';
+
const serverHostRemote = {
'auth-service': `https://auth-service${devServerSuffix}.macro.com`,
+ 'auth-logout': authLogoutUrl,
'pdf-service': `https://pdf-service${devServerSuffix}.macro.com`,
'document-storage-service': `https://cloud-storage${devServerSuffix}.macro.com`,
'websocket-service': `wss://services${devServerSuffix}.macro.com`,