Skip to content

Commit 5aaf7a0

Browse files
committed
Simplifies OAuth environment handling
Removes outdated references and console logs Dynamically constructs redirect URIs for better environment flexibility Fixes variable naming for token access
1 parent 94ce384 commit 5aaf7a0

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

editor/public/env-config.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@
88
window.env = {
99
VITE_BACKEND_BASE_URL: '__VITE_BACKEND_BASE_URL__',
1010
VITE_LOGIN_BASE_URL: '__VITE_LOGIN_BASE_URL__',
11-
VITE_OAUTH_CLIENT_ID: '__VITE_OAUTH_CLIENT_ID__',
12-
VITE_OAUTH_CLIENT_SECRET: '__VITE_OAUTH_CLIENT_SECRET__',
11+
VITE_OAUTH_WEB_CLIENT_ID: '__VITE_OAUTH_WEB_CLIENT_ID__',
12+
VITE_OAUTH_WEB_CLIENT_SECRET: '__VITE_OAUTH_WEB_CLIENT_SECRET__',
1313
VITE_GRAPHQL_URL: '__VITE_GRAPHQL_URL__',
1414
VITE_OAUTH_TOKEN_URL: '__VITE_OAUTH_TOKEN_URL__'
1515
};
1616

17-
console.log('🔧 Runtime environment loaded:', {
18-
backendBase: window.env.VITE_BACKEND_BASE_URL,
19-
loginBase: window.env.VITE_LOGIN_BASE_URL,
20-
clientId: window.env.VITE_OAUTH_CLIENT_ID ? 'SET' : 'NOT SET',
21-
clientSecret: window.env.VITE_OAUTH_CLIENT_SECRET ? 'SET' : 'NOT SET'
22-
});
17+
2318
})();

editor/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export default function App() {
422422
// Ensure unique step id within the parent activity to avoid selection confusion
423423
const parent = script.activities.find(a => a.id === targetParentActivityId);
424424
if (parent) {
425-
console.log('🔍 Found parent activity:', parent.id, 'existing steps:', parent.steps.map(s => s.id));
425+
426426
let baseId = step.id?.trim() || 'step';
427427
let candidate = baseId;
428428
let counter = 1;
@@ -433,11 +433,11 @@ export default function App() {
433433
}
434434
if (candidate !== step.id) {
435435
step = { ...step, id: candidate } as Step;
436-
console.log('🔍 Updated step id to:', candidate);
436+
437437
}
438438
}
439439

440-
console.log('🔍 Dispatching ADD_STEP with:', { parentActivityId: targetParentActivityId, stepId: step.id });
440+
441441
dispatch({ type: 'ADD_STEP', parentActivityId: targetParentActivityId, step, select: true });
442442
};
443443

editor/src/lib/auth-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface TokenResponse {
77
}
88

99
interface TokenData {
10-
cessToken: string;
10+
sToken: string;
1111
tokenType: string;
1212
expiresAt: Date;
1313
refreshToken?: string;

editor/src/lib/env.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ export const OAUTH_CONFIG = {
8787
return import.meta.env.VITE_OAUTH_WEB_CLIENT_SECRET || '';
8888
})(),
8989
redirectUri: (() => {
90-
// Try runtime environment first (for Azure App Service)
91-
const runtimeRedirectUri = (window as any)?.env?.VITE_OAUTH_REDIRECT_URI;
92-
if (runtimeRedirectUri && runtimeRedirectUri !== '__VITE_OAUTH_REDIRECT_URI__') {
93-
return runtimeRedirectUri;
94-
}
95-
return import.meta.env.VITE_OAUTH_REDIRECT_URI || '';
90+
// Build redirect URI dynamically from current window location
91+
// This automatically works for localhost, dev, staging, and production environments
92+
const origin = window.location.origin;
93+
return `${origin}/account/callback`;
9694
})(),
9795
scopes: [
9896
'openid',

0 commit comments

Comments
 (0)