better-auth 1.6.19 → 1.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -232,7 +232,7 @@ const getSession = () => createAuthEndpoint("/get-session", {
232
232
  deleteSessionCookie(ctx);
233
233
  throw APIError.from("UNAUTHORIZED", BASE_ERROR_CODES.FAILED_TO_GET_SESSION);
234
234
  }
235
- const maxAge = (updatedSession.expiresAt.valueOf() - Date.now()) / 1e3;
235
+ const maxAge = ctx.context.sessionConfig.expiresIn;
236
236
  await setSessionCookie(ctx, {
237
237
  session: updatedSession,
238
238
  user: session.user
@@ -3,12 +3,12 @@ import { setAccountCookie } from "../cookies/session-store.mjs";
3
3
  import { redirectOnError } from "./errors.mjs";
4
4
  import { setTokenUtil } from "./utils.mjs";
5
5
  import { createEmailVerificationToken } from "../api/routes/email-verification.mjs";
6
- import { isDevelopment, logger } from "@better-auth/core/env";
6
+ import { isDevelopment } from "@better-auth/core/env";
7
7
  //#region src/oauth2/link-account.ts
8
8
  async function handleOAuthUserInfo(c, opts) {
9
9
  const { userInfo, account, callbackURL, disableSignUp, overrideUserInfo } = opts;
10
10
  const dbUser = await c.context.internalAdapter.findOAuthUser(userInfo.email.toLowerCase(), account.accountId, account.providerId).catch((e) => {
11
- logger.error("Better auth was unable to query your database.\nError: ", e);
11
+ c.context.logger.error("Better auth was unable to query your database.\nError: ", e);
12
12
  redirectOnError(c, c.context.options.onAPIError?.errorURL || `${c.context.baseURL}/error`, "internal_server_error");
13
13
  });
14
14
  let user = dbUser?.user;
@@ -20,7 +20,7 @@ async function handleOAuthUserInfo(c, opts) {
20
20
  const isTrustedProvider = opts.isTrustedProvider || opts.trustProviderByName !== false && c.context.trustedProviders.includes(account.providerId);
21
21
  const requireLocalEmailVerified = accountLinking?.requireLocalEmailVerified ?? true;
22
22
  if (!isTrustedProvider && !userInfo.emailVerified || requireLocalEmailVerified && !dbUser.user.emailVerified || accountLinking?.enabled === false || accountLinking?.disableImplicitLinking === true) {
23
- if (isDevelopment()) logger.warn(`User already exist but account isn't linked to ${account.providerId}. To read more about how account linking works in Better Auth see https://www.better-auth.com/docs/concepts/users-accounts#account-linking.`);
23
+ if (isDevelopment()) c.context.logger.warn(`User already exist but account isn't linked to ${account.providerId}. To read more about how account linking works in Better Auth see https://www.better-auth.com/docs/concepts/users-accounts#account-linking.`);
24
24
  return {
25
25
  error: "account not linked",
26
26
  data: null
@@ -39,7 +39,7 @@ async function handleOAuthUserInfo(c, opts) {
39
39
  scope: account.scope
40
40
  });
41
41
  } catch (e) {
42
- logger.error("Unable to link account", e);
42
+ c.context.logger.error("Unable to link account", e);
43
43
  return {
44
44
  error: "unable to link account",
45
45
  data: null
@@ -105,7 +105,7 @@ async function handleOAuthUserInfo(c, opts) {
105
105
  }, c.request));
106
106
  }
107
107
  } catch (e) {
108
- logger.error(e);
108
+ c.context.logger.error(e);
109
109
  if (isAPIError(e)) return {
110
110
  error: e.message,
111
111
  data: null,
package/dist/package.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "1.6.19";
2
+ var version = "1.6.20";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth",
3
- "version": "1.6.19",
3
+ "version": "1.6.20",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -489,13 +489,13 @@
489
489
  "kysely": "^0.28.17 || ^0.29.0",
490
490
  "nanostores": "^1.1.1",
491
491
  "zod": "^4.3.6",
492
- "@better-auth/core": "1.6.19",
493
- "@better-auth/drizzle-adapter": "1.6.19",
494
- "@better-auth/kysely-adapter": "1.6.19",
495
- "@better-auth/memory-adapter": "1.6.19",
496
- "@better-auth/mongo-adapter": "1.6.19",
497
- "@better-auth/prisma-adapter": "1.6.19",
498
- "@better-auth/telemetry": "1.6.19"
492
+ "@better-auth/core": "1.6.20",
493
+ "@better-auth/drizzle-adapter": "1.6.20",
494
+ "@better-auth/kysely-adapter": "1.6.20",
495
+ "@better-auth/memory-adapter": "1.6.20",
496
+ "@better-auth/mongo-adapter": "1.6.20",
497
+ "@better-auth/prisma-adapter": "1.6.20",
498
+ "@better-auth/telemetry": "1.6.20"
499
499
  },
500
500
  "devDependencies": {
501
501
  "@lynx-js/react": "^0.116.3",