Fix failed login with access_token. Remove access_token when loading login route

This commit is contained in:
Karl Ludwig Weise
2026-01-26 20:46:42 +01:00
parent cfff6f786c
commit b05330c0c8
+11 -1
View File
@@ -1,7 +1,7 @@
import { fail } from "@sveltejs/kit";
import { superValidate } from "sveltekit-superforms";
import { zod4 as zod } from "sveltekit-superforms/adapters";
import type { Actions } from "./$types";
import type { Actions, PageServerLoad } from "./$types";
import { formSchema } from "./schema";
import type { WebAuthnCredential } from "$lib/server/auth/webauthn-service";
import type { TUser } from "$lib/types/user";
@@ -9,6 +9,16 @@ import logger from "$lib/logger";
const log = logger.setContext(import.meta.filename);
export const load: PageServerLoad = async (event) => {
// Remove any existing access token cookie
event.cookies.delete("access_token", {
path: "/",
httpOnly: true,
secure: true,
sameSite: "strict",
});
};
export const actions: Actions = {
default: async (event) => {
const form = await superValidate(event, zod(formSchema));