Skip to content

Commit c1fe7ee

Browse files
committed
fix: clear intermediate cookies
1 parent b4ce829 commit c1fe7ee

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/auth.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,20 @@ export async function getOAuthState(): Promise<{ state: string | null; codeVerif
135135

136136
export async function clearOAuthState(): Promise<void> {
137137
const cookieStore = await cookies();
138-
cookieStore.delete(OAUTH_CONFIG.STATE_COOKIE_NAME);
139-
cookieStore.delete(OAUTH_CONFIG.CODE_VERIFIER_COOKIE_NAME);
138+
cookieStore.delete({
139+
name: OAUTH_CONFIG.STATE_COOKIE_NAME,
140+
httpOnly: true,
141+
secure: true,
142+
sameSite: "lax",
143+
path: "/",
144+
});
145+
cookieStore.delete({
146+
name: OAUTH_CONFIG.CODE_VERIFIER_COOKIE_NAME,
147+
httpOnly: true,
148+
secure: true,
149+
sameSite: "lax",
150+
path: "/",
151+
});
140152
}
141153

142154
// OAuth URL builders

0 commit comments

Comments
 (0)