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