fix cookie on remote

This commit is contained in:
Shahrad Elahi 2023-11-08 01:52:00 +03:30
parent 1f189a710e
commit 771a0f301c

View File

@ -38,7 +38,22 @@ export const actions: Actions = {
}
const token = await generateToken();
event.cookies.set('authorization', token);
const { ORIGIN } = process.env;
if (ORIGIN) {
console.log('[+] TEST ONLY', 'ORIGIN', ORIGIN);
const secure = ORIGIN.startsWith('https://');
event.cookies.set('authorization', token, {
secure,
httpOnly: true,
path: '/'
});
} else {
event.cookies.set('authorization', token);
}
return { ok: true };
},