aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/logout/index.js
blob: 6cbae8f24e8304f98204d4b8293a04fd536ce9b0 (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)
				})
			]
		}
	};
}