completionId: cgen-db532f6e1d6b4772914ad076e32f23db
cgen-db532f6e1d6b4772914ad076e32f23db
This commit is contained in:
parent
e60015e38c
commit
779a5bffe7
1 changed files with 15 additions and 6 deletions
|
|
@ -751,12 +751,21 @@ export function createServer() {
|
||||||
.json({ error: "Discord client ID not configured" });
|
.json({ error: "Discord client ID not configured" });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current API base from the request origin
|
// Use the API base URL (should match Discord Dev Portal redirect URI)
|
||||||
const protocol =
|
let apiBase =
|
||||||
req.headers["x-forwarded-proto"] || req.protocol || "https";
|
process.env.VITE_API_BASE ||
|
||||||
const host =
|
process.env.API_BASE ||
|
||||||
req.headers["x-forwarded-host"] || req.hostname || req.get("host");
|
process.env.PUBLIC_BASE_URL ||
|
||||||
const apiBase = `${protocol}://${host}`;
|
process.env.SITE_URL;
|
||||||
|
|
||||||
|
if (!apiBase) {
|
||||||
|
// Fallback to request origin if no env var is set
|
||||||
|
const protocol =
|
||||||
|
req.headers["x-forwarded-proto"] || req.protocol || "https";
|
||||||
|
const host =
|
||||||
|
req.headers["x-forwarded-host"] || req.hostname || req.get("host");
|
||||||
|
apiBase = `${protocol}://${host}`;
|
||||||
|
}
|
||||||
|
|
||||||
const redirectUri = `${apiBase}/api/discord/oauth/callback`;
|
const redirectUri = `${apiBase}/api/discord/oauth/callback`;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue