From b7c314623f4e12598d7ee61fb444367549343565 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 11 Nov 2025 08:59:58 +0000 Subject: [PATCH] completionId: cgen-6576f8d39a5f48d2acbf92c4ab14b118 cgen-6576f8d39a5f48d2acbf92c4ab14b118 --- api/discord/oauth/callback.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/api/discord/oauth/callback.ts b/api/discord/oauth/callback.ts index 17db42c7..016d8008 100644 --- a/api/discord/oauth/callback.ts +++ b/api/discord/oauth/callback.ts @@ -300,26 +300,6 @@ export default async function handler(req: any, res: any) { // Redirect to magic link to establish session // The magic link contains the session token and will set cookies automatically res.redirect(linkData.properties.magic_link); - - // Redirect to dashboard (we only log in existing users here) - const nextPath = "/dashboard"; - - // Determine the base URL from environment or request origin - let baseUrl = process.env.VITE_API_BASE || process.env.API_BASE; - - if (!baseUrl && req.headers.referer) { - // Extract base URL from referer header as fallback - const refererUrl = new URL(req.headers.referer); - baseUrl = refererUrl.origin; - } - - // Final fallback - should not be needed if env vars are set - if (!baseUrl) { - baseUrl = "https://aethex.dev"; - } - - const redirectUrl = new URL(nextPath, baseUrl); - res.redirect(redirectUrl.toString()); } catch (error) { console.error("[Discord OAuth] Callback error:", error); res.redirect("/login?error=unknown");