diff --git a/packages/better-auth/package.json b/packages/better-auth/package.json index 56a778e8..28a3d5a5 100644 --- a/packages/better-auth/package.json +++ b/packages/better-auth/package.json @@ -600,7 +600,7 @@ "@noble/hashes": "^1.6.1", "@simplewebauthn/browser": "^13.0.0", "@simplewebauthn/server": "^13.0.0", - "better-call": "1.0.0-beta.6", + "better-call": "catalog:", "defu": "^6.1.4", "jose": "^5.9.6", "kysely": "^0.27.4", diff --git a/packages/better-auth/src/plugins/multi-session/index.ts b/packages/better-auth/src/plugins/multi-session/index.ts index 9c1ffa52..0cdf5606 100644 --- a/packages/better-auth/src/plugins/multi-session/index.ts +++ b/packages/better-auth/src/plugins/multi-session/index.ts @@ -236,17 +236,13 @@ export const multiSession = (options?: MultiSessionConfig) => { if (!cookieString) return; const setCookies = parseSetCookieHeader(cookieString); const sessionCookieConfig = ctx.context.authCookies.sessionToken; - const sessionToken = setCookies.get( - sessionCookieConfig.name, - )?.value; + const sessionToken = ctx.context.newSession?.session.token; if (!sessionToken) return; - const cookies = parseCookies(ctx.headers?.get("cookie") || ""); - const rawSession = sessionToken.split(".")[0]; - if (!rawSession) { + if (!sessionToken) { return; } - const cookieName = `${sessionCookieConfig.name}_multi-${rawSession}`; + const cookieName = `${sessionCookieConfig.name}_multi-${sessionToken}`; if (setCookies.get(cookieName) || cookies.get(cookieName)) return; @@ -261,7 +257,7 @@ export const multiSession = (options?: MultiSessionConfig) => { await ctx.setSignedCookie( cookieName, - rawSession, + sessionToken, ctx.context.secret, sessionCookieConfig.options, ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84f8d18a..4dd6bb36 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,12 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +catalogs: + default: + better-call: + specifier: ^1.0.1 + version: 1.0.1 + overrides: mdast-util-frontmatter: 2.0.1 remark-mdx: 3.0.0 @@ -194,7 +200,7 @@ importers: version: 11.13.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) geist: specifier: ^1.3.1 - version: 1.3.1(next@15.1.2(@babel/core@7.26.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1)) + version: 1.3.1(next@15.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1)) input-otp: specifier: ^1.4.1 version: 1.4.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -505,7 +511,7 @@ importers: version: 14.0.2(@types/react-dom@18.3.2)(@types/react@18.3.14)(next@15.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1) geist: specifier: ^1.3.1 - version: 1.3.1(next@15.1.2(@babel/core@7.26.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1)) + version: 1.3.1(next@15.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1)) input-otp: specifier: ^1.4.1 version: 1.4.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -1454,8 +1460,8 @@ importers: specifier: ^13.0.0 version: 13.0.0(encoding@0.1.13) better-call: - specifier: 1.0.0-beta.6 - version: 1.0.0-beta.6 + specifier: 'catalog:' + version: 1.0.1 defu: specifier: ^6.1.4 version: 6.1.4 @@ -9877,8 +9883,8 @@ packages: better-call@1.0.0-beta.5: resolution: {integrity: sha512-0Jzk5+58hnJWJpGIcrvmxLTqKGjtNGkAQ9zpSKvCC860TUJGdNHvK661pQ5JYKNnbcKORA52xglu4T/MqKJyrQ==} - better-call@1.0.0-beta.6: - resolution: {integrity: sha512-VEl+JPJuliYS4XtD9aWH2zdRTdAPSUGWsHZhFYkPC3Bt49xMTDDsgv/y0TGvioW/MLw+9Ni+QOhGQNBqQflFew==} + better-call@1.0.1: + resolution: {integrity: sha512-Z3DT2A290JiXvg5HXpyi3GrlfZnS3bGCrZ7Bii8pkDJC2DUUlWoRxpHDPISAl93lk1LLfuZoMsOZiMDfZ8B68w==} better-opn@3.0.2: resolution: {integrity: sha512-aVNobHnJqLiUelTaHat9DZ1qM2w0C0Eym4LPI/3JxOnSokGVdsl1T1kN7TFvsEAD8G47A6VKQ0TVHqbBnYMJlQ==} @@ -30609,7 +30615,7 @@ snapshots: set-cookie-parser: 2.7.1 uncrypto: 0.1.3 - better-call@1.0.0-beta.6: + better-call@1.0.1: dependencies: '@better-fetch/fetch': 1.1.12 rou3: 0.5.1 @@ -34106,7 +34112,7 @@ snapshots: strip-ansi: 6.0.1 wide-align: 1.1.5 - geist@1.3.1(next@15.1.2(@babel/core@7.26.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1)): + geist@1.3.1(next@15.1.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1)): dependencies: next: 15.1.2(@babel/core@7.26.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.83.1) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b01673b9..7a39530a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -10,3 +10,5 @@ catalogs: '@types/react-dom': ^18.3.2 react: 18.3.1 react-dom: 18.3.1 +catalog: + "better-call": "^1.0.1" \ No newline at end of file