aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/logout/index.js
blob: 80e65f8b0d23d6f262dd5006bac4c8a628106187 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cookie from "cookie";

const opts = {
  httpOnly: true,
  sameSite: "lax",
  path: "/",
};

export async function GET({ request: { headers } }) {
  return {
    status: 302,
    headers: {
      location: "/logout/done",
      "set-cookie": [
        cookie.serialize("token", "", {
          ...opts,
          expires: new Date(0),
        }),
        cookie.serialize("refresh_token", "", {
          ...opts,
          expires: new Date(0),
        }),
      ],
    },
  };
}