From 3b7c94344053e601d64abea9d7eaa7e15a32cd4d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 6 Dec 2022 14:14:41 +0900 Subject: [PATCH] =?UTF-8?q?fix(server):=20cookie=E3=81=8C=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/api/SigninService.ts | 2 +- .../backend/src/server/api/integration/DiscordServerService.ts | 2 +- .../backend/src/server/api/integration/GithubServerService.ts | 2 +- .../backend/src/server/api/integration/TwitterServerService.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/SigninService.ts b/packages/backend/src/server/api/SigninService.ts index 96a89956f..671278a18 100644 --- a/packages/backend/src/server/api/SigninService.ts +++ b/packages/backend/src/server/api/SigninService.ts @@ -43,7 +43,7 @@ export class SigninService { if (redirect) { //#region Cookie - reply.cookies.set('igi', user.token!, { + reply.setCookie('igi', user.token!, { path: '/', // SEE: https://github.com/koajs/koa/issues/974 // When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header diff --git a/packages/backend/src/server/api/integration/DiscordServerService.ts b/packages/backend/src/server/api/integration/DiscordServerService.ts index a7f39a78d..e6e79f3d3 100644 --- a/packages/backend/src/server/api/integration/DiscordServerService.ts +++ b/packages/backend/src/server/api/integration/DiscordServerService.ts @@ -122,7 +122,7 @@ export class DiscordServerService { response_type: 'code', }; - reply.cookies.set('signin_with_discord_sid', sessid, { + reply.setCookie('signin_with_discord_sid', sessid, { path: '/', secure: this.config.url.startsWith('https'), httpOnly: true, diff --git a/packages/backend/src/server/api/integration/GithubServerService.ts b/packages/backend/src/server/api/integration/GithubServerService.ts index 186748dab..e6c42e1ee 100644 --- a/packages/backend/src/server/api/integration/GithubServerService.ts +++ b/packages/backend/src/server/api/integration/GithubServerService.ts @@ -120,7 +120,7 @@ export class GithubServerService { state: uuid(), }; - reply.cookies.set('signin_with_github_sid', sessid, { + reply.setCookie('signin_with_github_sid', sessid, { path: '/', secure: this.config.url.startsWith('https'), httpOnly: true, diff --git a/packages/backend/src/server/api/integration/TwitterServerService.ts b/packages/backend/src/server/api/integration/TwitterServerService.ts index 7a127fa29..747f59c7a 100644 --- a/packages/backend/src/server/api/integration/TwitterServerService.ts +++ b/packages/backend/src/server/api/integration/TwitterServerService.ts @@ -112,7 +112,7 @@ export class TwitterServerService { this.redisClient.set(sessid, JSON.stringify(twCtx)); - reply.cookies.set('signin_with_twitter_sid', sessid, { + reply.setCookie('signin_with_twitter_sid', sessid, { path: '/', secure: this.config.url.startsWith('https'), httpOnly: true,