From 316492e9331d3eda71bb2f877683e8d650ecf451 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 26 May 2024 09:35:06 +0800 Subject: [PATCH] Add SameSite=None --- routes/api/_middleware.ts | 2 +- routes/api/token.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/api/_middleware.ts b/routes/api/_middleware.ts index 3bbe1f6..f5d0422 100644 --- a/routes/api/_middleware.ts +++ b/routes/api/_middleware.ts @@ -95,7 +95,7 @@ export async function handler(req: Request, ctx: FreshContext) { "Set-Cookie", `token=${t.token}; Expires=${t.expired.toUTCString()}${ t.http_only ? "; HttpOnly" : "" - }${t.secure ? "; Secure" : ""}; Path=/api`, + }${t.secure ? "; SameSite=None; Secure" : ""}; Path=/api`, ); } catch { null; diff --git a/routes/api/token.ts b/routes/api/token.ts index 4123d52..78874dd 100644 --- a/routes/api/token.ts +++ b/routes/api/token.ts @@ -67,7 +67,7 @@ export const handler: Handlers = { if (is_from_auth && is_from_cookie) { headers["Set-Cookie"] = `token=${token.token}; Max-Age=0${ token.http_only ? "; HttpOnly" : "" - }${token.secure ? "; Secure" : ""}; Path=/api`; + }${token.secure ? "; SameSite=None; Secure" : ""}; Path=/api`; } return return_data(true, 200, headers); },