diff --git a/packages/whook-oauth2/src/services/authCookies.ts b/packages/whook-oauth2/src/services/authCookies.ts index 92da5711..0040f991 100644 --- a/packages/whook-oauth2/src/services/authCookies.ts +++ b/packages/whook-oauth2/src/services/authCookies.ts @@ -48,7 +48,7 @@ async function initAuthCookies({ httpOnly: true, domain: ENV.DEV_MODE ? undefined : COOKIES.domain, secure: !ENV.DEV_MODE, - sameSite: ENV.DEV_MODE ? 'none' : true, + ...(ENV.DEV_MODE ? {} : { sameSite: true }), ...(data.access_token ? {} : { maxAge: 0 }), }), cookie.serialize('refresh_token', data.refresh_token || '', { @@ -56,7 +56,7 @@ async function initAuthCookies({ httpOnly: true, domain: ENV.DEV_MODE ? undefined : COOKIES.domain, secure: !ENV.DEV_MODE, - sameSite: ENV.DEV_MODE ? 'none' : true, + ...(ENV.DEV_MODE ? {} : { sameSite: true }), ...(session ? {} : { maxAge: Math.round(ms('100y') / 1000) }), }), ];