Fix Discord OAuth callback cookie extraction and session handling
cgen-67f1518e94174ee99ab95377d5e7ebe8
This commit is contained in:
parent
829489ffe1
commit
5775084d0a
1 changed files with 5 additions and 1 deletions
|
|
@ -89,7 +89,11 @@ export default async function handler(req: any, res: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const redirectUri = "https://aethex.dev/api/discord/oauth/callback";
|
// 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}`;
|
||||||
|
const redirectUri = `${apiBase}/api/discord/oauth/callback`;
|
||||||
|
|
||||||
// Exchange code for access token
|
// Exchange code for access token
|
||||||
const tokenResponse = await fetch(
|
const tokenResponse = await fetch(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue