a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove auth token properly on logout

+13 -1
+2 -1
actions/logout.ts
··· 1 1 "use server"; 2 2 3 3 import { cookies } from "next/headers"; 4 + import { removeAuthToken } from "src/auth"; 4 5 5 6 export async function logout() { 6 - (await cookies()).delete("auth_token"); 7 + await removeAuthToken(); 7 8 (await cookies()).delete("identity"); 8 9 }
+11
src/auth.ts
··· 11 11 sameSite: "lax", 12 12 }); 13 13 } 14 + 15 + export async function removeAuthToken() { 16 + let c = await cookies(); 17 + c.delete({ 18 + name: "auth_token", 19 + secure: process.env.NODE_ENV === "production", 20 + domain: isProductionDomain() ? "leaflet.pub" : undefined, 21 + httpOnly: true, 22 + sameSite: "lax", 23 + }); 24 + }