@better-auth/oauth-provider 1.6.18 → 1.6.19

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.
@@ -1,5 +1,5 @@
1
- import { a as getJwtPlugin, b as handleMcpErrors, o as getOAuthProviderPlugin } from "./utils-B8pHZVEm.mjs";
2
- import { t as PACKAGE_VERSION } from "./version-D8-vU8KW.mjs";
1
+ import { a as getJwtPlugin, b as handleMcpErrors, o as getOAuthProviderPlugin } from "./utils-CN81wPAr.mjs";
2
+ import { t as PACKAGE_VERSION } from "./version-BOM1iw6q.mjs";
3
3
  import { verifyAccessToken } from "better-auth/oauth2";
4
4
  import { APIError } from "better-call";
5
5
  import { logger } from "@better-auth/core/env";
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as buildSignedOAuthQuery, t as PACKAGE_VERSION } from "./version-D8-vU8KW.mjs";
1
+ import { n as buildSignedOAuthQuery, t as PACKAGE_VERSION } from "./version-BOM1iw6q.mjs";
2
2
  import { safeJSONParse } from "@better-auth/core/utils/json";
3
3
  //#region src/client.ts
4
4
  const oauthProviderClient = () => {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as storeToken, a as getJwtPlugin, c as isPKCERequired, d as parsePrompt, f as removePromptFromQuery, g as storeClientSecret, h as searchParamsToQuery, i as getClient, l as normalizeTimestampValue, m as resolveSubjectIdentifier, n as clientAllowsGrant, p as resolveSessionAuthTime, r as decryptStoredClientSecret, s as getStoredToken, t as basicToClientCredentials, u as parseClientMetadata, v as validateClientCredentials, x as mcpHandler, y as verifyOAuthQueryParams } from "./utils-B8pHZVEm.mjs";
2
- import { a as postLoginClearedParam, i as getSignedQueryIssuedAt, o as setSignedOAuthQueryParameterNames, r as canonicalizeOAuthQueryParams, s as signedQueryIssuedAtParam, t as PACKAGE_VERSION } from "./version-D8-vU8KW.mjs";
1
+ import { _ as storeToken, a as getJwtPlugin, c as isPKCERequired, d as parsePrompt, f as removePromptFromQuery, g as storeClientSecret, h as searchParamsToQuery, i as getClient, l as normalizeTimestampValue, m as resolveSubjectIdentifier, n as clientAllowsGrant, p as resolveSessionAuthTime, r as decryptStoredClientSecret, s as getStoredToken, t as basicToClientCredentials, u as parseClientMetadata, v as validateClientCredentials, x as mcpHandler, y as verifyOAuthQueryParams } from "./utils-CN81wPAr.mjs";
2
+ import { a as postLoginClearedParam, i as getSignedQueryIssuedAt, o as setSignedOAuthQueryParameterNames, r as canonicalizeOAuthQueryParams, s as signedQueryIssuedAtParam, t as PACKAGE_VERSION } from "./version-BOM1iw6q.mjs";
3
3
  import { APIError, createAuthEndpoint, createAuthMiddleware, dispatchAuthEndpoint, getOAuthState, getSessionFromCtx, sessionMiddleware } from "better-auth/api";
4
4
  import { generateCodeChallenge, getJwks, verifyJwsAccessToken } from "better-auth/oauth2";
5
5
  import { APIError as APIError$1 } from "better-call";
@@ -457,7 +457,7 @@ async function createRefreshToken(ctx, opts, user, referenceId, client, scopes,
457
457
  })).id,
458
458
  token: await encodeRefreshToken(opts, token, sessionId)
459
459
  };
460
- if (!await ctx.context.adapter.update({
460
+ if (!await ctx.context.adapter.incrementOne({
461
461
  model: "oauthRefreshToken",
462
462
  where: [{
463
463
  field: "id",
@@ -467,7 +467,8 @@ async function createRefreshToken(ctx, opts, user, referenceId, client, scopes,
467
467
  operator: "eq",
468
468
  value: null
469
469
  }],
470
- update: { revoked: /* @__PURE__ */ new Date(iat * 1e3) }
470
+ increment: {},
471
+ set: { revoked: /* @__PURE__ */ new Date(iat * 1e3) }
471
472
  })) throw new APIError("BAD_REQUEST", {
472
473
  error_description: "invalid refresh token",
473
474
  error: "invalid_grant"
@@ -2348,7 +2349,7 @@ async function revokeRefreshToken(ctx, opts, token, clientId) {
2348
2349
  }
2349
2350
  if (!refreshToken.clientId || refreshToken.clientId !== clientId) return null;
2350
2351
  const iat = Math.floor(Date.now() / 1e3);
2351
- if (!await ctx.context.adapter.update({
2352
+ if (!await ctx.context.adapter.incrementOne({
2352
2353
  model: "oauthRefreshToken",
2353
2354
  where: [{
2354
2355
  field: "id",
@@ -2358,7 +2359,8 @@ async function revokeRefreshToken(ctx, opts, token, clientId) {
2358
2359
  operator: "eq",
2359
2360
  value: null
2360
2361
  }],
2361
- update: { revoked: /* @__PURE__ */ new Date(iat * 1e3) }
2362
+ increment: {},
2363
+ set: { revoked: /* @__PURE__ */ new Date(iat * 1e3) }
2362
2364
  })) {
2363
2365
  await invalidateRefreshFamily(ctx, clientId, refreshToken.userId);
2364
2366
  throw new APIError$1("BAD_REQUEST", {
@@ -1,4 +1,4 @@
1
- import { r as canonicalizeOAuthQueryParams } from "./version-D8-vU8KW.mjs";
1
+ import { r as canonicalizeOAuthQueryParams } from "./version-BOM1iw6q.mjs";
2
2
  import { isAPIError } from "better-auth/api";
3
3
  import { verifyAccessToken } from "better-auth/oauth2";
4
4
  import { APIError as APIError$1 } from "better-call";
@@ -42,6 +42,6 @@ function getSignedQueryIssuedAt(oauthQuery) {
42
42
  }
43
43
  //#endregion
44
44
  //#region src/version.ts
45
- const PACKAGE_VERSION = "1.6.18";
45
+ const PACKAGE_VERSION = "1.6.19";
46
46
  //#endregion
47
47
  export { postLoginClearedParam as a, getSignedQueryIssuedAt as i, buildSignedOAuthQuery as n, setSignedOAuthQueryParameterNames as o, canonicalizeOAuthQueryParams as r, signedQueryIssuedAtParam as s, PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/oauth-provider",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "description": "An oauth provider plugin for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -64,15 +64,15 @@
64
64
  "@modelcontextprotocol/sdk": "^1.27.1",
65
65
  "listhen": "^1.9.0",
66
66
  "tsdown": "0.21.1",
67
- "@better-auth/core": "1.6.18",
68
- "better-auth": "1.6.18"
67
+ "@better-auth/core": "1.6.19",
68
+ "better-auth": "1.6.19"
69
69
  },
70
70
  "peerDependencies": {
71
- "@better-auth/utils": "0.4.1",
72
- "@better-fetch/fetch": "1.3.0",
71
+ "@better-auth/utils": "0.4.2",
72
+ "@better-fetch/fetch": "1.3.1",
73
73
  "better-call": "1.3.6",
74
- "@better-auth/core": "^1.6.18",
75
- "better-auth": "^1.6.18"
74
+ "@better-auth/core": "^1.6.19",
75
+ "better-auth": "^1.6.19"
76
76
  },
77
77
  "scripts": {
78
78
  "build": "tsdown",