mirror of
https://github.com/PeterMaquiran/tvone.git
synced 2026-04-21 10:25:42 +00:00
This commit is contained in:
@@ -7,13 +7,13 @@ export async function GET(req: Request) {
|
||||
const url = new URL(req.url);
|
||||
const code = url.searchParams.get("code");
|
||||
const isHttps = url.protocol === "https:";
|
||||
const domain = env.COOKIE_DOMAIN ?? getCookieDomain(url.hostname);
|
||||
|
||||
|
||||
if (!code) {
|
||||
return NextResponse.redirect(`${BASE_URL}/login?error=missing_code`);
|
||||
}
|
||||
|
||||
const redirectUri = `${origin}/api/auth/callback`;
|
||||
const redirectUri = `${BASE_URL}/api/auth/callback`;
|
||||
|
||||
const tokenRes = await fetch(
|
||||
`${env.KEYCLOAK_BASE_URL}/realms/${env.KEYCLOAK_REALM}/protocol/openid-connect/token`,
|
||||
@@ -52,7 +52,7 @@ export async function GET(req: Request) {
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
maxAge: data.expires_in,
|
||||
...(domain ? { domain } : {}),
|
||||
...(BASE_URL ? { BASE_URL } : {}),
|
||||
});
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user