#270 - Add base path to cookie string for correct path handling
authorAdam Dullage <redacted>
Sat, 14 Jun 2025 05:48:17 +0000 (06:48 +0100)
committerAdam Dullage <redacted>
Sat, 14 Jun 2025 05:48:17 +0000 (06:48 +0100)
client/tokenStorage.js

index 959af4d069b1b231b962451fa9592aa1dcaeec74..12c4e38f0af9b6355ad83b19f6f9e132a4861c04 100644 (file)
@@ -1,7 +1,13 @@
 const tokenStorageKey = "token";
 
+function getBasePath() {
+  // This relies on the fact that flanotes always has a correctly formatted relative path set in <base> tag
+  return document.querySelector('base').getAttribute('href')
+}
+
 function getCookieString(token) {
-  return `${tokenStorageKey}=${token}; SameSite=Strict`;
+  const basePath = getBasePath();
+  return `${tokenStorageKey}=${token}; Path=${basePath}; SameSite=Strict`;
 }
 
 export function storeToken(token, persist = false) {
git clone https://git.99rst.org/PROJECT