Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: Check if VERCEL_DEPLOYMENT

Richie McIlroybc49589d5856
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index 579255fbb..b4435a299 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -16,7 +16,9 @@ export function middleware(request: NextRequest) {
if (token && !cookieIsSet) {
const response = NextResponse.next();
response.cookies.set({
- name: "next-auth.session-token",
+ name: VERCEL_DEPLOYMENT
+ ? "__Secure-next-auth.session-token"
+ : "next-auth.session-token",
value: token,
path: "/",
sameSite: "none",
diff --git a/packages/database/auth/auth-options.ts b/packages/database/auth/auth-options.ts
index 603360dcd..6db1dfd34 100644
--- a/packages/database/auth/auth-options.ts
+++ b/packages/database/auth/auth-options.ts
@@ -36,7 +36,9 @@ export const authOptions: NextAuthOptions = {
],
cookies: {
sessionToken: {
- name: `next-auth.session-token`,
+ name: VERCEL_DEPLOYMENT
+ ? "__Secure-next-auth.session-token"
+ : "next-auth.session-token",
options: {
httpOnly: true,
sameSite: "none",