Fix expired access token: Do not check access token for public routes

This commit is contained in:
Karl Ludwig Weise
2026-01-26 20:42:51 +01:00
parent 75cdccf5d0
commit cfff6f786c
2 changed files with 14 additions and 5 deletions
+9
View File
@@ -12,6 +12,15 @@ const GLOBAL_ADMIN_PATHS = ["/api/admin"];
export const apiAuthHandle: Handle = async ({ event, resolve }) => {
const { url } = event;
const path = url.pathname;
// Public api paths should be available without authentication
const whitelist = ["/api/public"];
const skip = whitelist.some((wlPath) => path.startsWith(wlPath));
if (skip) {
return resolve(event);
}
// Front-End routes are not handled here
if (!path.startsWith("/api")) {
return resolve(event);
}