Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: cookie name (#4293)

Peng Xiao46fd732ee63a
diff --git a/apps/server/src/modules/auth/next-auth.controller.ts b/apps/server/src/modules/auth/next-auth.controller.ts
index 6119439e9a..1e562e7088 100644
--- a/apps/server/src/modules/auth/next-auth.controller.ts
+++ b/apps/server/src/modules/auth/next-auth.controller.ts
@@ -148,13 +148,15 @@ export class NextAuthController {
}
let nextAuthTokenCookie: (CookieOption & { value: string }) | undefined;
+ const cookiePrefix = this.config.node.prod ? '__Secure-' : '';
+ const sessionCookieName = `${cookiePrefix}next-auth.session-token`;
// next-auth credentials login only support JWT strategy
// https://next-auth.js.org/configuration/providers/credentials
// let's store the session token in the database
if (
credentialsSignIn &&
(nextAuthTokenCookie = cookies?.find(
- ({ name }) => name === 'next-auth.session-token'
+ ({ name }) => name === sessionCookieName
))
) {
const cookieExpires = new Date();