Skip to content

Commit 0d98dad

Browse files
committed
fix(auth): Set the cookie's SameSite policy to "lax"
Safari's SameSite policy applies throughout the entire session. This means that when we redirect to Google, then back to the callback, and finally to the homepage, the last redirect does not meet the strict SameSite requirements. As a result, the user must log in again. According to https://datatracker.ietf.org/doc/html/draft-ietf-oauth-browser-based-apps#section-6.1.3.3.1, SameSite can be set to Lax.
1 parent db646c2 commit 0d98dad

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export async function setAuthToken(
5050
cookieStore.set(OAUTH_CONFIG.TOKEN_COOKIE_NAME, token, {
5151
httpOnly: true,
5252
secure: true,
53-
sameSite: "strict",
53+
sameSite: "lax",
5454
maxAge: expiresIn,
5555
path: "/",
5656
});
@@ -68,7 +68,7 @@ export async function clearAuthToken(): Promise<void> {
6868
name: OAUTH_CONFIG.TOKEN_COOKIE_NAME,
6969
httpOnly: true,
7070
secure: true,
71-
sameSite: "strict",
71+
sameSite: "lax",
7272
path: "/",
7373
});
7474
}

0 commit comments

Comments
 (0)