completionId: cgen-6576f8d39a5f48d2acbf92c4ab14b118
cgen-6576f8d39a5f48d2acbf92c4ab14b118
This commit is contained in:
parent
e1ae88a7be
commit
b7c314623f
1 changed files with 0 additions and 20 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue