import cookie from "cookie" ; import { NextApiRequest , NextApiResponse } from "next" ; import { ok , AuthRouteHandlerOptions } from "." ; export function createLogout ( options ) { return async function logout ( req , res ) { const serializedCookie = cookie . serialize ( options . serverConfig . cookieName , "" , { sameSite : "lax" , secure : options . serverConfig . secure , maxAge : - 1 , httpOnly : true , path : "/" , } ) ; res . setHeader ( "Set-Cookie" , serializedCookie ) ; ok ( res ) ; } ; }