completionId: cgen-9c165472fa87466c8c034000852c961f
cgen-9c165472fa87466c8c034000852c961f
This commit is contained in:
parent
cb6cc15aef
commit
4c180012b8
1 changed files with 3 additions and 6 deletions
|
|
@ -12,12 +12,9 @@ export default function handler(req: any, res: any) {
|
|||
return res.status(500).json({ error: "Discord client ID not configured" });
|
||||
}
|
||||
|
||||
// Get the current API base from the request origin
|
||||
const protocol =
|
||||
req.headers["x-forwarded-proto"] || req.headers.protocol || "https";
|
||||
const host = req.headers["x-forwarded-host"] || req.headers.host;
|
||||
const apiBase = `${protocol}://${host}`;
|
||||
|
||||
// Use the main API base domain to ensure the redirect_uri matches the registered one
|
||||
// This is critical because Discord OAuth requires exact match of redirect_uri
|
||||
const apiBase = process.env.VITE_API_BASE || "https://aethex.dev";
|
||||
const redirectUri = `${apiBase}/api/discord/oauth/callback`;
|
||||
|
||||
// Get the state from query params (can be a JSON string with action and redirectTo)
|
||||
|
|
|
|||
Loading…
Reference in a new issue