improvements

This commit is contained in:
yohlo
2025-09-29 11:43:48 -05:00
parent a4b9fe9065
commit 48aeaabeea
5 changed files with 8 additions and 9 deletions

View File

@@ -112,7 +112,7 @@ export const Route = createFileRoute("/api/spotify/callback")({
});
const isSecure = import.meta.env.NODE_ENV === "production";
const cookieOptions = `HttpOnly; Secure=${isSecure}; SameSite=Strict; Path=/; Max-Age=${tokens.expires_in}`;
const cookieOptions = `HttpOnly; ${isSecure ? 'Secure; ' : ''}SameSite=Lax; Path=/; Max-Age=${tokens.expires_in}`;
response.headers.append(
"Set-Cookie",
@@ -120,7 +120,7 @@ export const Route = createFileRoute("/api/spotify/callback")({
);
if (tokens.refresh_token) {
const refreshCookieOptions = `HttpOnly; Secure=${isSecure}; SameSite=Strict; Path=/; Max-Age=${60 * 60 * 24 * 30}`; // 30 days
const refreshCookieOptions = `HttpOnly; ${isSecure ? 'Secure; ' : ''}SameSite=Lax; Path=/; Max-Age=${60 * 60 * 24 * 30}`; // 30 days
response.headers.append(
"Set-Cookie",
`spotify_refresh_token=${tokens.refresh_token}; ${refreshCookieOptions}`