mirror of
https://github.com/PeterMaquiran/tvone.git
synced 2026-04-22 12:05:51 +00:00
fix sameSite
This commit is contained in:
@@ -35,7 +35,7 @@ export async function GET(req: Request) {
|
||||
response.cookies.set("access_token", data.access_token, {
|
||||
httpOnly: true,
|
||||
secure: isHttps,
|
||||
sameSite: "none",
|
||||
sameSite: isHttps ? "none" : "lax",
|
||||
path: "/",
|
||||
...(env.COOKIE_DOMAIN ? { domain: env.COOKIE_DOMAIN } : {}),
|
||||
maxAge: data.expires_in,
|
||||
@@ -44,7 +44,7 @@ export async function GET(req: Request) {
|
||||
response.cookies.set("refresh_token", data.refresh_token, {
|
||||
httpOnly: true,
|
||||
secure: isHttps,
|
||||
sameSite: "none",
|
||||
sameSite: isHttps ? "none" : "lax",
|
||||
path: "/",
|
||||
...(env.COOKIE_DOMAIN ? { domain: env.COOKIE_DOMAIN } : {}),
|
||||
maxAge: data.expires_in,
|
||||
|
||||
@@ -3,13 +3,15 @@ import { NextResponse } from "next/server";
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const { token } = await req.json();
|
||||
const isHttps = new URL(req.url).protocol === "https:";
|
||||
|
||||
|
||||
const res = NextResponse.json({ ok: true });
|
||||
|
||||
res.cookies.set("auth_token", token, {
|
||||
httpOnly: true,
|
||||
secure: true,
|
||||
sameSite: "none",
|
||||
sameSite: isHttps ? "none" : "lax",
|
||||
...(env.COOKIE_DOMAIN ? { domain: env.COOKIE_DOMAIN } : {}),
|
||||
path: "/",
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// /**
|
||||
// * TOKEN REFRESHER
|
||||
// * Logic: Silent background token rotation.
|
||||
// * Role: Communicates with Keycloak to exchange a Refresh Token for a new Access Token.
|
||||
// */
|
||||
// // /**
|
||||
// // * TOKEN REFRESHER
|
||||
// // * Logic: Silent background token rotation.
|
||||
// // * Role: Communicates with Keycloak to exchange a Refresh Token for a new Access Token.
|
||||
// // */
|
||||
|
||||
// import { keycloakConfig } from './keycloak-config';
|
||||
// // import { keycloakConfig } from './keycloak-config';
|
||||
|
||||
// export const refreshAccessToken = async (token: any) => {
|
||||
// try {
|
||||
|
||||
Reference in New Issue
Block a user