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

@@ -5,5 +5,6 @@ import { currentUser } from '$lib/stores/user_store';
pb.authStore.loadFromCookie(document.cookie)
pb.authStore.onChange(() => {
currentUser.set(pb.authStore.model as User)
document.cookie = pb.authStore.exportToCookie({ httpOnly: false, secure: location.protocol === "https:" || location.hostname === "localhost", sameSite: 'none' })
const secure = location.protocol === "https:"
document.cookie = pb.authStore.exportToCookie({ httpOnly: false, secure: secure, sameSite: "Lax" })
}, true)