completionId: cgen-0c318fecb8884accbe9298eddad0a8f7
cgen-0c318fecb8884accbe9298eddad0a8f7
This commit is contained in:
parent
4c180012b8
commit
51649d6ae8
1 changed files with 3 additions and 4 deletions
|
|
@ -116,10 +116,9 @@ export default async function handler(req: any, res: any) {
|
|||
}
|
||||
|
||||
try {
|
||||
// Get the current API base from the request origin
|
||||
const protocol = req.headers["x-forwarded-proto"] || "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`;
|
||||
|
||||
// Exchange code for access token
|
||||
|
|
|
|||
Loading…
Reference in a new issue