Skip to content

Scheduling infrastructure for absolutely everyone.

refactor: cookie domain logic in defaultCookies (#22168)

Omar Lópeze17d55457fd7
diff --git a/packages/lib/default-cookies.ts b/packages/lib/default-cookies.ts
index bfd5a9b4345..19d987b0873 100644
--- a/packages/lib/default-cookies.ts
+++ b/packages/lib/default-cookies.ts
@@ -1,7 +1,5 @@
import type { CookieOption, CookiesOptions } from "next-auth";
-import { isENVDev } from "@calcom/lib/env";
-
/**
* Copy from 'https://github.com/nextauthjs/next-auth/blob/227ff2259f/src/core/lib/cookie.ts' as we can't import it directly
*
@@ -20,12 +18,7 @@ export function defaultCookies(useSecureCookies: boolean): CookiesOptions {
const cookiePrefix = useSecureCookies ? "__Secure-" : "";
const defaultOptions: CookieOption["options"] = {
- domain: isENVDev
- ? process.env.ORGANIZATIONS_ENABLED
- ? //FIXME: This is causing login to not work if someone uses anything other .cal.local for testing
- ".cal.local"
- : undefined
- : NEXTAUTH_COOKIE_DOMAIN,
+ domain: NEXTAUTH_COOKIE_DOMAIN || undefined,
// To enable cookies on widgets,
// https://stackoverflow.com/questions/45094712/iframe-not-reading-cookies-in-chrome
// But we need to set it as `lax` in development