improvements
This commit is contained in:
@@ -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}`
|
||||
|
||||
Reference in New Issue
Block a user