fixes SameSite cookie issue

This commit is contained in:
Christian Beutel
2025-02-16 20:47:52 +01:00
parent 77ffa48ee0
commit 6b35ca96d6
2 changed files with 5 additions and 2 deletions

View File

@@ -103,9 +103,11 @@ const auth: Handle = async ({ event, resolve }) => {
const response = await resolve(event)
// send back the default 'pb_auth' cookie to the client with the latest store state
const secure = event.url.protocol === "https:"
response.headers.set(
'set-cookie',
pb.authStore.exportToCookie({ httpOnly: false, secure: event.url.protocol === "https:" || event.url.hostname === "localhost", sameSite: "none" })
pb.authStore.exportToCookie({ httpOnly: false, secure: secure, sameSite: "Lax" })
)
return response