From b230d56dab7bb57a396fe59cf84520bfb54727a2 Mon Sep 17 00:00:00 2001 From: amy Date: Tue, 3 Dec 2024 17:44:29 +0330 Subject: [PATCH] cookies are now based --- src/main.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 1125773..ea8a474 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,6 +17,11 @@ if (!process.env.ADMINS) { process.exit(1); } +if (!process.env.ORIGIN_BASEDOMAIN) { + console.error("no origin base domain found"); + process.exit(1); +} + if (!process.env.ORIGIN) { console.error("no origin found"); process.exit(1); @@ -108,7 +113,11 @@ fastify.get('/login/callback', async function (request, reply) { }, }) } - reply.setCookie('access_token', refreshToken.access_token); + reply.setCookie('access_token', refreshToken.access_token, { + domain: process.env.ORIGIN_BASEDOMAIN, + path: '/', + maxAge: 31_622_400, + }); return reply.send({access_token: refreshToken.access_token}); });