better-auth 1.2.5-beta.9 → 1.2.6-beta.1

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.
Files changed (197) hide show
  1. package/dist/adapters/drizzle-adapter/index.d.cts +3 -3
  2. package/dist/adapters/drizzle-adapter/index.d.mts +3 -3
  3. package/dist/adapters/drizzle-adapter/index.d.ts +3 -3
  4. package/dist/adapters/kysely-adapter/index.d.cts +3 -3
  5. package/dist/adapters/kysely-adapter/index.d.mts +3 -3
  6. package/dist/adapters/kysely-adapter/index.d.ts +3 -3
  7. package/dist/adapters/memory-adapter/index.d.cts +3 -3
  8. package/dist/adapters/memory-adapter/index.d.mts +3 -3
  9. package/dist/adapters/memory-adapter/index.d.ts +3 -3
  10. package/dist/adapters/mongodb-adapter/index.d.cts +3 -3
  11. package/dist/adapters/mongodb-adapter/index.d.mts +3 -3
  12. package/dist/adapters/mongodb-adapter/index.d.ts +3 -3
  13. package/dist/adapters/prisma-adapter/index.d.cts +3 -3
  14. package/dist/adapters/prisma-adapter/index.d.mts +3 -3
  15. package/dist/adapters/prisma-adapter/index.d.ts +3 -3
  16. package/dist/adapters/test.d.cts +3 -3
  17. package/dist/adapters/test.d.mts +3 -3
  18. package/dist/adapters/test.d.ts +3 -3
  19. package/dist/api/index.cjs +77 -75
  20. package/dist/api/index.d.cts +4 -4
  21. package/dist/api/index.d.mts +4 -4
  22. package/dist/api/index.d.ts +4 -4
  23. package/dist/api/index.mjs +6 -5
  24. package/dist/client/index.d.cts +4 -4
  25. package/dist/client/index.d.mts +4 -4
  26. package/dist/client/index.d.ts +4 -4
  27. package/dist/client/plugins/index.d.cts +4 -4
  28. package/dist/client/plugins/index.d.mts +4 -4
  29. package/dist/client/plugins/index.d.ts +4 -4
  30. package/dist/client/react/index.d.cts +4 -4
  31. package/dist/client/react/index.d.mts +4 -4
  32. package/dist/client/react/index.d.ts +4 -4
  33. package/dist/client/solid/index.d.cts +4 -4
  34. package/dist/client/solid/index.d.mts +4 -4
  35. package/dist/client/solid/index.d.ts +4 -4
  36. package/dist/client/svelte/index.d.cts +4 -4
  37. package/dist/client/svelte/index.d.mts +4 -4
  38. package/dist/client/svelte/index.d.ts +4 -4
  39. package/dist/client/vue/index.d.cts +4 -4
  40. package/dist/client/vue/index.d.mts +4 -4
  41. package/dist/client/vue/index.d.ts +4 -4
  42. package/dist/cookies/index.d.cts +3 -3
  43. package/dist/cookies/index.d.mts +3 -3
  44. package/dist/cookies/index.d.ts +3 -3
  45. package/dist/db/index.cjs +1 -1
  46. package/dist/db/index.d.cts +4 -4
  47. package/dist/db/index.d.mts +4 -4
  48. package/dist/db/index.d.ts +4 -4
  49. package/dist/db/index.mjs +1 -1
  50. package/dist/index.cjs +5 -5
  51. package/dist/index.d.cts +4 -4
  52. package/dist/index.d.mts +4 -4
  53. package/dist/index.d.ts +4 -4
  54. package/dist/index.mjs +4 -4
  55. package/dist/integrations/next-js.cjs +5 -5
  56. package/dist/integrations/next-js.d.cts +3 -3
  57. package/dist/integrations/next-js.d.mts +3 -3
  58. package/dist/integrations/next-js.d.ts +3 -3
  59. package/dist/integrations/next-js.mjs +4 -4
  60. package/dist/integrations/node.d.cts +3 -3
  61. package/dist/integrations/node.d.mts +3 -3
  62. package/dist/integrations/node.d.ts +3 -3
  63. package/dist/integrations/svelte-kit.d.cts +3 -3
  64. package/dist/integrations/svelte-kit.d.mts +3 -3
  65. package/dist/integrations/svelte-kit.d.ts +3 -3
  66. package/dist/oauth2/index.cjs +7 -6
  67. package/dist/oauth2/index.d.cts +14 -5
  68. package/dist/oauth2/index.d.mts +14 -5
  69. package/dist/oauth2/index.d.ts +14 -5
  70. package/dist/oauth2/index.mjs +1 -1
  71. package/dist/plugins/admin/index.cjs +3 -3
  72. package/dist/plugins/admin/index.d.cts +3 -3
  73. package/dist/plugins/admin/index.d.mts +3 -3
  74. package/dist/plugins/admin/index.d.ts +3 -3
  75. package/dist/plugins/admin/index.mjs +3 -3
  76. package/dist/plugins/anonymous/index.cjs +5 -5
  77. package/dist/plugins/anonymous/index.d.cts +3 -3
  78. package/dist/plugins/anonymous/index.d.mts +3 -3
  79. package/dist/plugins/anonymous/index.d.ts +3 -3
  80. package/dist/plugins/anonymous/index.mjs +2 -2
  81. package/dist/plugins/bearer/index.cjs +4 -4
  82. package/dist/plugins/bearer/index.d.cts +3 -3
  83. package/dist/plugins/bearer/index.d.mts +3 -3
  84. package/dist/plugins/bearer/index.d.ts +3 -3
  85. package/dist/plugins/bearer/index.mjs +2 -2
  86. package/dist/plugins/custom-session/index.cjs +4 -4
  87. package/dist/plugins/custom-session/index.d.cts +3 -3
  88. package/dist/plugins/custom-session/index.d.mts +3 -3
  89. package/dist/plugins/custom-session/index.d.ts +3 -3
  90. package/dist/plugins/custom-session/index.mjs +2 -2
  91. package/dist/plugins/email-otp/index.cjs +10 -10
  92. package/dist/plugins/email-otp/index.d.cts +3 -3
  93. package/dist/plugins/email-otp/index.d.mts +3 -3
  94. package/dist/plugins/email-otp/index.d.ts +3 -3
  95. package/dist/plugins/email-otp/index.mjs +2 -2
  96. package/dist/plugins/generic-oauth/index.cjs +43 -19
  97. package/dist/plugins/generic-oauth/index.d.cts +4 -4
  98. package/dist/plugins/generic-oauth/index.d.mts +4 -4
  99. package/dist/plugins/generic-oauth/index.d.ts +4 -4
  100. package/dist/plugins/generic-oauth/index.mjs +29 -5
  101. package/dist/plugins/index.cjs +22 -22
  102. package/dist/plugins/index.d.cts +4 -4
  103. package/dist/plugins/index.d.mts +4 -4
  104. package/dist/plugins/index.d.ts +4 -4
  105. package/dist/plugins/index.mjs +6 -6
  106. package/dist/plugins/jwt/index.cjs +6 -6
  107. package/dist/plugins/jwt/index.d.cts +3 -3
  108. package/dist/plugins/jwt/index.d.mts +3 -3
  109. package/dist/plugins/jwt/index.d.ts +3 -3
  110. package/dist/plugins/jwt/index.mjs +2 -2
  111. package/dist/plugins/magic-link/index.cjs +6 -6
  112. package/dist/plugins/magic-link/index.mjs +2 -2
  113. package/dist/plugins/multi-session/index.cjs +9 -9
  114. package/dist/plugins/multi-session/index.d.cts +3 -3
  115. package/dist/plugins/multi-session/index.d.mts +3 -3
  116. package/dist/plugins/multi-session/index.d.ts +3 -3
  117. package/dist/plugins/multi-session/index.mjs +2 -2
  118. package/dist/plugins/oauth-proxy/index.cjs +6 -6
  119. package/dist/plugins/oauth-proxy/index.d.cts +3 -3
  120. package/dist/plugins/oauth-proxy/index.d.mts +3 -3
  121. package/dist/plugins/oauth-proxy/index.d.ts +3 -3
  122. package/dist/plugins/oauth-proxy/index.mjs +2 -2
  123. package/dist/plugins/oidc-provider/index.cjs +14 -14
  124. package/dist/plugins/oidc-provider/index.d.cts +3 -3
  125. package/dist/plugins/oidc-provider/index.d.mts +3 -3
  126. package/dist/plugins/oidc-provider/index.d.ts +3 -3
  127. package/dist/plugins/oidc-provider/index.mjs +2 -2
  128. package/dist/plugins/one-tap/index.cjs +3 -3
  129. package/dist/plugins/one-tap/index.mjs +2 -2
  130. package/dist/plugins/open-api/index.cjs +4 -4
  131. package/dist/plugins/open-api/index.d.cts +3 -3
  132. package/dist/plugins/open-api/index.d.mts +3 -3
  133. package/dist/plugins/open-api/index.d.ts +3 -3
  134. package/dist/plugins/open-api/index.mjs +2 -2
  135. package/dist/plugins/organization/index.cjs +3 -3
  136. package/dist/plugins/organization/index.d.cts +3 -3
  137. package/dist/plugins/organization/index.d.mts +3 -3
  138. package/dist/plugins/organization/index.d.ts +3 -3
  139. package/dist/plugins/organization/index.mjs +3 -3
  140. package/dist/plugins/passkey/index.cjs +15 -15
  141. package/dist/plugins/passkey/index.d.cts +3 -3
  142. package/dist/plugins/passkey/index.d.mts +3 -3
  143. package/dist/plugins/passkey/index.d.ts +3 -3
  144. package/dist/plugins/passkey/index.mjs +2 -2
  145. package/dist/plugins/phone-number/index.cjs +13 -13
  146. package/dist/plugins/phone-number/index.d.cts +3 -3
  147. package/dist/plugins/phone-number/index.d.mts +3 -3
  148. package/dist/plugins/phone-number/index.d.ts +3 -3
  149. package/dist/plugins/phone-number/index.mjs +2 -2
  150. package/dist/plugins/sso/index.cjs +11 -11
  151. package/dist/plugins/sso/index.d.cts +2 -2
  152. package/dist/plugins/sso/index.d.mts +2 -2
  153. package/dist/plugins/sso/index.d.ts +2 -2
  154. package/dist/plugins/sso/index.mjs +3 -3
  155. package/dist/plugins/two-factor/index.cjs +20 -20
  156. package/dist/plugins/two-factor/index.d.cts +3 -3
  157. package/dist/plugins/two-factor/index.d.mts +3 -3
  158. package/dist/plugins/two-factor/index.d.ts +3 -3
  159. package/dist/plugins/two-factor/index.mjs +3 -3
  160. package/dist/plugins/username/index.cjs +9 -9
  161. package/dist/plugins/username/index.d.cts +3 -3
  162. package/dist/plugins/username/index.d.mts +3 -3
  163. package/dist/plugins/username/index.d.ts +3 -3
  164. package/dist/plugins/username/index.mjs +2 -2
  165. package/dist/shared/{better-auth.oyDBIJLs.mjs → better-auth.2rfXmCNS.mjs} +1 -1
  166. package/dist/shared/{better-auth.KTt7CS7L.mjs → better-auth.9knM1kR4.mjs} +1 -1
  167. package/dist/shared/{better-auth.DiMBK1Ep.mjs → better-auth.B2THyVQH.mjs} +54 -1
  168. package/dist/shared/{better-auth.C8tekzhG.cjs → better-auth.B7irTavj.cjs} +35 -35
  169. package/dist/shared/{better-auth.Dd96RDNl.d.ts → better-auth.BAfIsot3.d.ts} +41 -2
  170. package/dist/shared/{better-auth.Dunt9jpN.d.cts → better-auth.BBG0jAhH.d.mts} +2 -2
  171. package/dist/shared/{better-auth.CxMUffeh.d.cts → better-auth.BDAwKjlL.d.cts} +567 -46
  172. package/dist/shared/{better-auth.CbBX7Xla.mjs → better-auth.BK4Kh5QZ.mjs} +19 -17
  173. package/dist/shared/{better-auth.DgXCgiHI.cjs → better-auth.BLV8UOn8.cjs} +54 -0
  174. package/dist/shared/{better-auth.BjoUuJNr.d.mts → better-auth.BTnAiI8e.d.mts} +41 -2
  175. package/dist/shared/{better-auth.CzK7QJBv.d.cts → better-auth.CH6fRG6d.d.cts} +41 -2
  176. package/dist/shared/{better-auth.dzwyqpra.d.mts → better-auth.CTQDLJN7.d.mts} +567 -46
  177. package/dist/shared/{better-auth.CEuqoYDM.d.mts → better-auth.CtSY9Kmu.d.cts} +2 -2
  178. package/dist/shared/{better-auth.Cz2saE_0.d.cts → better-auth.DAnkIG1r.d.cts} +1 -1
  179. package/dist/shared/{better-auth.4ZqMps6Z.d.ts → better-auth.DCxEy-As.d.ts} +1 -1
  180. package/dist/shared/{better-auth.D7hUw1_Y.d.ts → better-auth.DIOWNBS2.d.ts} +1 -1
  181. package/dist/shared/{better-auth.ybwxmbrM.mjs → better-auth.DQ-pFMwp.mjs} +118 -5
  182. package/dist/shared/{better-auth.BxC2ipUB.d.mts → better-auth.DZPJQ81N.d.mts} +1 -1
  183. package/dist/shared/{better-auth.CL_N_Cfq.cjs → better-auth.DqGx7Ip8.cjs} +20 -20
  184. package/dist/shared/{better-auth.wspQErD2.cjs → better-auth.TNTVT6jt.cjs} +3 -3
  185. package/dist/shared/{better-auth.4J4_zAGP.cjs → better-auth.b0MLzqQX.cjs} +118 -4
  186. package/dist/shared/{better-auth.CdPDif0r.mjs → better-auth.cN4sTcuQ.mjs} +1 -1
  187. package/dist/shared/{better-auth.X0ynzeu1.cjs → better-auth.q7ChvjiM.cjs} +19 -17
  188. package/dist/shared/{better-auth.CixnJ90x.d.ts → better-auth.tpz8D0AA.d.ts} +567 -46
  189. package/dist/social-providers/index.cjs +197 -32
  190. package/dist/social-providers/index.d.cts +1 -1
  191. package/dist/social-providers/index.d.mts +1 -1
  192. package/dist/social-providers/index.d.ts +1 -1
  193. package/dist/social-providers/index.mjs +166 -1
  194. package/dist/types/index.d.cts +4 -4
  195. package/dist/types/index.d.mts +4 -4
  196. package/dist/types/index.d.ts +4 -4
  197. package/package.json +3 -3
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
- import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.CxMUffeh.cjs';
2
+ import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.BDAwKjlL.cjs';
3
3
  import '../../shared/better-auth.Bi8FQwDD.cjs';
4
4
  import 'zod';
5
- import 'kysely';
6
- import '../../shared/better-auth.CzK7QJBv.cjs';
5
+ import '../../shared/better-auth.CH6fRG6d.cjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface UserWithAnonymous extends User {
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
- import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.dzwyqpra.mjs';
2
+ import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.CTQDLJN7.mjs';
3
3
  import '../../shared/better-auth.Bi8FQwDD.mjs';
4
4
  import 'zod';
5
- import 'kysely';
6
- import '../../shared/better-auth.BjoUuJNr.mjs';
5
+ import '../../shared/better-auth.BTnAiI8e.mjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface UserWithAnonymous extends User {
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
- import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.CixnJ90x.js';
2
+ import { U as User, S as Session, I as InferOptionSchema, H as HookEndpointContext } from '../../shared/better-auth.tpz8D0AA.js';
3
3
  import '../../shared/better-auth.Bi8FQwDD.js';
4
4
  import 'zod';
5
- import 'kysely';
6
- import '../../shared/better-auth.Dd96RDNl.js';
5
+ import '../../shared/better-auth.BAfIsot3.js';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface UserWithAnonymous extends User {
@@ -1,5 +1,5 @@
1
1
  import { APIError } from 'better-call';
2
- import { c as createAuthMiddleware, a as createAuthEndpoint, g as getSessionFromCtx } from '../../shared/better-auth.ybwxmbrM.mjs';
2
+ import { c as createAuthMiddleware, a as createAuthEndpoint, g as getSessionFromCtx } from '../../shared/better-auth.DQ-pFMwp.mjs';
3
3
  import 'zod';
4
4
  import { parseSetCookieHeader, setSessionCookie } from '../../cookies/index.mjs';
5
5
  import { m as mergeSchema } from '../../shared/better-auth.CepcSj5H.mjs';
@@ -10,7 +10,7 @@ import { g as getOrigin } from '../../shared/better-auth.VTXNLFMT.mjs';
10
10
  import '../../social-providers/index.mjs';
11
11
  import '@better-fetch/fetch';
12
12
  import 'jose';
13
- import '../../shared/better-auth.DiMBK1Ep.mjs';
13
+ import '../../shared/better-auth.B2THyVQH.mjs';
14
14
  import '../../shared/better-auth.CW6D9eSx.mjs';
15
15
  import '@better-auth/utils/hash';
16
16
  import '@better-auth/utils/base64';
@@ -5,7 +5,7 @@ require('../../shared/better-auth.DiSjtgs9.cjs');
5
5
  require('@better-auth/utils/base64');
6
6
  const hmac = require('@better-auth/utils/hmac');
7
7
  const cookies_index = require('../../cookies/index.cjs');
8
- const account = require('../../shared/better-auth.4J4_zAGP.cjs');
8
+ const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
9
9
  require('zod');
10
10
  require('../../shared/better-auth.C5H9XEzZ.cjs');
11
11
  require('../../shared/better-auth.GpOOav9x.cjs');
@@ -17,7 +17,7 @@ require('../../shared/better-auth.C-R0J0n1.cjs');
17
17
  require('../../social-providers/index.cjs');
18
18
  require('@better-fetch/fetch');
19
19
  require('jose');
20
- require('../../shared/better-auth.DgXCgiHI.cjs');
20
+ require('../../shared/better-auth.BLV8UOn8.cjs');
21
21
  require('@better-auth/utils/hash');
22
22
  require('@noble/ciphers/chacha');
23
23
  require('@noble/ciphers/utils');
@@ -45,7 +45,7 @@ const bearer = (options) => {
45
45
  context.request?.headers.get("authorization") || context.headers?.get("authorization")
46
46
  );
47
47
  },
48
- handler: account.createAuthMiddleware(async (c) => {
48
+ handler: refreshToken.createAuthMiddleware(async (c) => {
49
49
  const token = c.request?.headers.get("authorization")?.replace("Bearer ", "") || c.headers?.get("Authorization")?.replace("Bearer ", "");
50
50
  if (!token) {
51
51
  return;
@@ -96,7 +96,7 @@ const bearer = (options) => {
96
96
  matcher(context) {
97
97
  return true;
98
98
  },
99
- handler: account.createAuthMiddleware(async (ctx) => {
99
+ handler: refreshToken.createAuthMiddleware(async (ctx) => {
100
100
  const setCookie = ctx.context.responseHeaders?.get("set-cookie");
101
101
  if (!setCookie) {
102
102
  return;
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
- import { H as HookEndpointContext } from '../../shared/better-auth.CxMUffeh.cjs';
2
+ import { H as HookEndpointContext } from '../../shared/better-auth.BDAwKjlL.cjs';
3
3
  import '../../shared/better-auth.Bi8FQwDD.cjs';
4
4
  import 'zod';
5
- import 'kysely';
6
- import '../../shared/better-auth.CzK7QJBv.cjs';
5
+ import '../../shared/better-auth.CH6fRG6d.cjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface BearerOptions {
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
- import { H as HookEndpointContext } from '../../shared/better-auth.dzwyqpra.mjs';
2
+ import { H as HookEndpointContext } from '../../shared/better-auth.CTQDLJN7.mjs';
3
3
  import '../../shared/better-auth.Bi8FQwDD.mjs';
4
4
  import 'zod';
5
- import 'kysely';
6
- import '../../shared/better-auth.BjoUuJNr.mjs';
5
+ import '../../shared/better-auth.BTnAiI8e.mjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface BearerOptions {
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
- import { H as HookEndpointContext } from '../../shared/better-auth.CixnJ90x.js';
2
+ import { H as HookEndpointContext } from '../../shared/better-auth.tpz8D0AA.js';
3
3
  import '../../shared/better-auth.Bi8FQwDD.js';
4
4
  import 'zod';
5
- import 'kysely';
6
- import '../../shared/better-auth.Dd96RDNl.js';
5
+ import '../../shared/better-auth.BAfIsot3.js';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface BearerOptions {
@@ -3,7 +3,7 @@ import '../../shared/better-auth.8zoxzg-F.mjs';
3
3
  import '@better-auth/utils/base64';
4
4
  import { createHMAC } from '@better-auth/utils/hmac';
5
5
  import { parseSetCookieHeader } from '../../cookies/index.mjs';
6
- import { c as createAuthMiddleware } from '../../shared/better-auth.ybwxmbrM.mjs';
6
+ import { c as createAuthMiddleware } from '../../shared/better-auth.DQ-pFMwp.mjs';
7
7
  import 'zod';
8
8
  import '../../shared/better-auth.CepcSj5H.mjs';
9
9
  import '../../shared/better-auth.DH3YjMQH.mjs';
@@ -15,7 +15,7 @@ import '../../shared/better-auth.VTXNLFMT.mjs';
15
15
  import '../../social-providers/index.mjs';
16
16
  import '@better-fetch/fetch';
17
17
  import 'jose';
18
- import '../../shared/better-auth.DiMBK1Ep.mjs';
18
+ import '../../shared/better-auth.B2THyVQH.mjs';
19
19
  import '@better-auth/utils/hash';
20
20
  import '@noble/ciphers/chacha';
21
21
  import '@noble/ciphers/utils';
@@ -2,7 +2,7 @@
2
2
 
3
3
  const zod = require('zod');
4
4
  require('better-call');
5
- const account = require('../../shared/better-auth.4J4_zAGP.cjs');
5
+ const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
6
6
  require('../../shared/better-auth.DiSjtgs9.cjs');
7
7
  require('@better-auth/utils/base64');
8
8
  require('@better-auth/utils/hmac');
@@ -17,7 +17,7 @@ require('../../shared/better-auth.C-R0J0n1.cjs');
17
17
  require('../../social-providers/index.cjs');
18
18
  require('@better-fetch/fetch');
19
19
  require('jose');
20
- require('../../shared/better-auth.DgXCgiHI.cjs');
20
+ require('../../shared/better-auth.BLV8UOn8.cjs');
21
21
  require('@better-auth/utils/hash');
22
22
  require('@noble/ciphers/chacha');
23
23
  require('@noble/ciphers/utils');
@@ -38,7 +38,7 @@ const customSession = (fn, options) => {
38
38
  return {
39
39
  id: "custom-session",
40
40
  endpoints: {
41
- getSession: account.createAuthEndpoint(
41
+ getSession: refreshToken.createAuthEndpoint(
42
42
  "/get-session",
43
43
  {
44
44
  method: "GET",
@@ -61,7 +61,7 @@ const customSession = (fn, options) => {
61
61
  )
62
62
  },
63
63
  async (ctx) => {
64
- const session = await account.getSessionFromCtx(ctx);
64
+ const session = await refreshToken.getSessionFromCtx(ctx);
65
65
  if (!session) {
66
66
  return ctx.json(null);
67
67
  }
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
2
  import { z } from 'zod';
3
- import { f as BetterAuthOptions, j as InferUser, k as InferSession } from '../../shared/better-auth.CxMUffeh.cjs';
3
+ import { f as BetterAuthOptions, j as InferUser, k as InferSession } from '../../shared/better-auth.BDAwKjlL.cjs';
4
4
  import '../../shared/better-auth.Bi8FQwDD.cjs';
5
- import 'kysely';
6
- import '../../shared/better-auth.CzK7QJBv.cjs';
5
+ import '../../shared/better-auth.CH6fRG6d.cjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  declare const customSession: <Returns extends Record<string, any>, O extends BetterAuthOptions = BetterAuthOptions>(fn: (session: {
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
2
  import { z } from 'zod';
3
- import { f as BetterAuthOptions, j as InferUser, k as InferSession } from '../../shared/better-auth.dzwyqpra.mjs';
3
+ import { f as BetterAuthOptions, j as InferUser, k as InferSession } from '../../shared/better-auth.CTQDLJN7.mjs';
4
4
  import '../../shared/better-auth.Bi8FQwDD.mjs';
5
- import 'kysely';
6
- import '../../shared/better-auth.BjoUuJNr.mjs';
5
+ import '../../shared/better-auth.BTnAiI8e.mjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  declare const customSession: <Returns extends Record<string, any>, O extends BetterAuthOptions = BetterAuthOptions>(fn: (session: {
@@ -1,10 +1,10 @@
1
1
  import * as better_call from 'better-call';
2
2
  import { z } from 'zod';
3
- import { f as BetterAuthOptions, j as InferUser, k as InferSession } from '../../shared/better-auth.CixnJ90x.js';
3
+ import { f as BetterAuthOptions, j as InferUser, k as InferSession } from '../../shared/better-auth.tpz8D0AA.js';
4
4
  import '../../shared/better-auth.Bi8FQwDD.js';
5
- import 'kysely';
6
- import '../../shared/better-auth.Dd96RDNl.js';
5
+ import '../../shared/better-auth.BAfIsot3.js';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  declare const customSession: <Returns extends Record<string, any>, O extends BetterAuthOptions = BetterAuthOptions>(fn: (session: {
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import 'better-call';
3
- import { a as createAuthEndpoint, g as getSessionFromCtx } from '../../shared/better-auth.ybwxmbrM.mjs';
3
+ import { a as createAuthEndpoint, g as getSessionFromCtx } from '../../shared/better-auth.DQ-pFMwp.mjs';
4
4
  import '../../shared/better-auth.8zoxzg-F.mjs';
5
5
  import '@better-auth/utils/base64';
6
6
  import '@better-auth/utils/hmac';
@@ -15,7 +15,7 @@ import '../../shared/better-auth.VTXNLFMT.mjs';
15
15
  import '../../social-providers/index.mjs';
16
16
  import '@better-fetch/fetch';
17
17
  import 'jose';
18
- import '../../shared/better-auth.DiMBK1Ep.mjs';
18
+ import '../../shared/better-auth.B2THyVQH.mjs';
19
19
  import '@better-auth/utils/hash';
20
20
  import '@noble/ciphers/chacha';
21
21
  import '@noble/ciphers/utils';
@@ -2,7 +2,7 @@
2
2
 
3
3
  const zod = require('zod');
4
4
  const betterCall = require('better-call');
5
- const account = require('../../shared/better-auth.4J4_zAGP.cjs');
5
+ const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
6
6
  const cookies_index = require('../../cookies/index.cjs');
7
7
  require('../../shared/better-auth.C5H9XEzZ.cjs');
8
8
  require('../../shared/better-auth.DiSjtgs9.cjs');
@@ -23,7 +23,7 @@ const date = require('../../shared/better-auth.C1hdVENX.cjs');
23
23
  const pluginHelper = require('../../shared/better-auth.DNqtHmvg.cjs');
24
24
  require('../../social-providers/index.cjs');
25
25
  require('@better-fetch/fetch');
26
- require('../../shared/better-auth.DgXCgiHI.cjs');
26
+ require('../../shared/better-auth.BLV8UOn8.cjs');
27
27
  require('../../shared/better-auth.ANpbi45u.cjs');
28
28
  require('@better-auth/utils/random');
29
29
  require('../../shared/better-auth.QbbyHMYf.cjs');
@@ -51,7 +51,7 @@ const emailOTP = (options) => {
51
51
  return {
52
52
  id: "email-otp",
53
53
  endpoints: {
54
- sendVerificationOTP: account.createAuthEndpoint(
54
+ sendVerificationOTP: refreshToken.createAuthEndpoint(
55
55
  "/email-otp/send-verification-otp",
56
56
  {
57
57
  method: "POST",
@@ -141,7 +141,7 @@ const emailOTP = (options) => {
141
141
  });
142
142
  }
143
143
  ),
144
- createVerificationOTP: account.createAuthEndpoint(
144
+ createVerificationOTP: refreshToken.createAuthEndpoint(
145
145
  "/email-otp/create-verification-otp",
146
146
  {
147
147
  method: "POST",
@@ -186,7 +186,7 @@ const emailOTP = (options) => {
186
186
  return otp;
187
187
  }
188
188
  ),
189
- getVerificationOTP: account.createAuthEndpoint(
189
+ getVerificationOTP: refreshToken.createAuthEndpoint(
190
190
  "/email-otp/get-verification-otp",
191
191
  {
192
192
  method: "GET",
@@ -235,7 +235,7 @@ const emailOTP = (options) => {
235
235
  });
236
236
  }
237
237
  ),
238
- verifyEmailOTP: account.createAuthEndpoint(
238
+ verifyEmailOTP: refreshToken.createAuthEndpoint(
239
239
  "/email-otp/verify-email",
240
240
  {
241
241
  method: "POST",
@@ -352,7 +352,7 @@ const emailOTP = (options) => {
352
352
  });
353
353
  }
354
354
  ),
355
- signInEmailOTP: account.createAuthEndpoint(
355
+ signInEmailOTP: refreshToken.createAuthEndpoint(
356
356
  "/sign-in/email-otp",
357
357
  {
358
358
  method: "POST",
@@ -481,7 +481,7 @@ const emailOTP = (options) => {
481
481
  });
482
482
  }
483
483
  ),
484
- forgetPasswordEmailOTP: account.createAuthEndpoint(
484
+ forgetPasswordEmailOTP: refreshToken.createAuthEndpoint(
485
485
  "/forget-password/email-otp",
486
486
  {
487
487
  method: "POST",
@@ -543,7 +543,7 @@ const emailOTP = (options) => {
543
543
  });
544
544
  }
545
545
  ),
546
- resetPasswordEmailOTP: account.createAuthEndpoint(
546
+ resetPasswordEmailOTP: refreshToken.createAuthEndpoint(
547
547
  "/email-otp/reset-password",
548
548
  {
549
549
  method: "POST",
@@ -651,7 +651,7 @@ const emailOTP = (options) => {
651
651
  matcher(context) {
652
652
  return !!(context.path?.startsWith("/sign-up") && opts.sendVerificationOnSignUp);
653
653
  },
654
- handler: account.createAuthMiddleware(async (ctx) => {
654
+ handler: refreshToken.createAuthMiddleware(async (ctx) => {
655
655
  const response = await pluginHelper.getEndpointResponse(ctx);
656
656
  const email = response?.user.email;
657
657
  if (email) {
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { H as HookEndpointContext } from '../../shared/better-auth.CxMUffeh.cjs';
3
+ import { H as HookEndpointContext } from '../../shared/better-auth.BDAwKjlL.cjs';
4
4
  import '../../shared/better-auth.Bi8FQwDD.cjs';
5
- import 'kysely';
6
- import '../../shared/better-auth.CzK7QJBv.cjs';
5
+ import '../../shared/better-auth.CH6fRG6d.cjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface EmailOTPOptions {
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { H as HookEndpointContext } from '../../shared/better-auth.dzwyqpra.mjs';
3
+ import { H as HookEndpointContext } from '../../shared/better-auth.CTQDLJN7.mjs';
4
4
  import '../../shared/better-auth.Bi8FQwDD.mjs';
5
- import 'kysely';
6
- import '../../shared/better-auth.BjoUuJNr.mjs';
5
+ import '../../shared/better-auth.BTnAiI8e.mjs';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface EmailOTPOptions {
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { H as HookEndpointContext } from '../../shared/better-auth.CixnJ90x.js';
3
+ import { H as HookEndpointContext } from '../../shared/better-auth.tpz8D0AA.js';
4
4
  import '../../shared/better-auth.Bi8FQwDD.js';
5
- import 'kysely';
6
- import '../../shared/better-auth.Dd96RDNl.js';
5
+ import '../../shared/better-auth.BAfIsot3.js';
7
6
  import 'jose';
7
+ import 'kysely';
8
8
  import 'better-sqlite3';
9
9
 
10
10
  interface EmailOTPOptions {
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { APIError } from 'better-call';
3
- import { c as createAuthMiddleware, a as createAuthEndpoint } from '../../shared/better-auth.ybwxmbrM.mjs';
3
+ import { c as createAuthMiddleware, a as createAuthEndpoint } from '../../shared/better-auth.DQ-pFMwp.mjs';
4
4
  import { setSessionCookie } from '../../cookies/index.mjs';
5
5
  import '../../shared/better-auth.CepcSj5H.mjs';
6
6
  import '../../shared/better-auth.8zoxzg-F.mjs';
@@ -21,7 +21,7 @@ import { g as getDate } from '../../shared/better-auth.CW6D9eSx.mjs';
21
21
  import { g as getEndpointResponse } from '../../shared/better-auth.DQI8AD7d.mjs';
22
22
  import '../../social-providers/index.mjs';
23
23
  import '@better-fetch/fetch';
24
- import '../../shared/better-auth.DiMBK1Ep.mjs';
24
+ import '../../shared/better-auth.B2THyVQH.mjs';
25
25
  import '../../shared/better-auth.DdzSJf-n.mjs';
26
26
  import '@better-auth/utils/random';
27
27
  import '../../shared/better-auth.BdyOG_p4.mjs';
@@ -3,13 +3,13 @@
3
3
  const fetch = require('@better-fetch/fetch');
4
4
  const betterCall = require('better-call');
5
5
  const zod = require('zod');
6
- const account = require('../../shared/better-auth.4J4_zAGP.cjs');
6
+ const refreshToken = require('../../shared/better-auth.b0MLzqQX.cjs');
7
7
  const cookies_index = require('../../cookies/index.cjs');
8
8
  require('../../shared/better-auth.C5H9XEzZ.cjs');
9
9
  require('../../shared/better-auth.DiSjtgs9.cjs');
10
10
  require('../../shared/better-auth.GpOOav9x.cjs');
11
11
  require('defu');
12
- const validateAuthorizationCode = require('../../shared/better-auth.DgXCgiHI.cjs');
12
+ const refreshAccessToken = require('../../shared/better-auth.BLV8UOn8.cjs');
13
13
  require('@better-auth/utils/hash');
14
14
  require('@better-auth/utils/base64');
15
15
  const state = require('../../shared/better-auth.QbbyHMYf.cjs');
@@ -79,7 +79,7 @@ const genericOAuth = (options) => {
79
79
  id: c.providerId,
80
80
  name: c.providerId,
81
81
  createAuthorizationURL(data) {
82
- return validateAuthorizationCode.createAuthorizationURL({
82
+ return refreshAccessToken.createAuthorizationURL({
83
83
  id: c.providerId,
84
84
  options: {
85
85
  clientId: c.clientId,
@@ -109,7 +109,7 @@ const genericOAuth = (options) => {
109
109
  message: "Invalid OAuth configuration. Token URL not found."
110
110
  });
111
111
  }
112
- return validateAuthorizationCode.validateAuthorizationCode({
112
+ return refreshAccessToken.validateAuthorizationCode({
113
113
  code: data.code,
114
114
  codeVerifier: data.codeVerifier,
115
115
  redirectURI: data.redirectURI,
@@ -118,8 +118,31 @@ const genericOAuth = (options) => {
118
118
  clientSecret: c.clientSecret,
119
119
  redirectURI: c.redirectURI
120
120
  },
121
- tokenEndpoint: finalTokenUrl,
122
- authentication: c.authentication
121
+ tokenEndpoint: finalTokenUrl
122
+ });
123
+ },
124
+ async refreshAccessToken(refreshToken) {
125
+ let finalTokenUrl = c.tokenUrl;
126
+ if (c.discoveryUrl) {
127
+ const discovery = await fetch.betterFetch(c.discoveryUrl, {
128
+ method: "GET"
129
+ });
130
+ if (discovery.data) {
131
+ finalTokenUrl = discovery.data.token_endpoint;
132
+ }
133
+ }
134
+ if (!finalTokenUrl) {
135
+ throw new betterCall.APIError("BAD_REQUEST", {
136
+ message: "Invalid OAuth configuration. Token URL not found."
137
+ });
138
+ }
139
+ return refreshAccessToken.refreshAccessToken({
140
+ refreshToken,
141
+ options: {
142
+ clientId: c.clientId,
143
+ clientSecret: c.clientSecret
144
+ },
145
+ tokenEndpoint: finalTokenUrl
123
146
  });
124
147
  },
125
148
  async getUserInfo(tokens) {
@@ -151,7 +174,7 @@ const genericOAuth = (options) => {
151
174
  };
152
175
  },
153
176
  endpoints: {
154
- signInWithOAuth2: account.createAuthEndpoint(
177
+ signInWithOAuth2: refreshToken.createAuthEndpoint(
155
178
  "/sign-in/oauth2",
156
179
  {
157
180
  method: "POST",
@@ -227,7 +250,8 @@ const genericOAuth = (options) => {
227
250
  prompt,
228
251
  accessType,
229
252
  authorizationUrlParams,
230
- responseMode
253
+ responseMode,
254
+ authentication
231
255
  } = config;
232
256
  let finalAuthUrl = authorizationUrl;
233
257
  let finalTokenUrl = tokenUrl;
@@ -259,7 +283,7 @@ const genericOAuth = (options) => {
259
283
  finalAuthUrl = withAdditionalParams.toString();
260
284
  }
261
285
  const { state: state$1, codeVerifier } = await state.generateState(ctx);
262
- const authUrl = await validateAuthorizationCode.createAuthorizationURL({
286
+ const authUrl = await refreshAccessToken.createAuthorizationURL({
263
287
  id: providerId,
264
288
  options: {
265
289
  clientId,
@@ -282,7 +306,7 @@ const genericOAuth = (options) => {
282
306
  });
283
307
  }
284
308
  ),
285
- oAuth2Callback: account.createAuthEndpoint(
309
+ oAuth2Callback: refreshToken.createAuthEndpoint(
286
310
  "/oauth2/callback/:providerId",
287
311
  {
288
312
  method: "GET",
@@ -371,7 +395,7 @@ const genericOAuth = (options) => {
371
395
  message: "Invalid OAuth configuration."
372
396
  });
373
397
  }
374
- tokens = await validateAuthorizationCode.validateAuthorizationCode({
398
+ tokens = await refreshAccessToken.validateAuthorizationCode({
375
399
  code,
376
400
  codeVerifier: provider.pkce ? codeVerifier : void 0,
377
401
  redirectURI: `${ctx.context.baseURL}/oauth2/callback/${provider.providerId}`,
@@ -427,7 +451,7 @@ const genericOAuth = (options) => {
427
451
  }
428
452
  throw ctx.redirect(toRedirectTo2);
429
453
  }
430
- const result = await account.handleOAuthUserInfo(ctx, {
454
+ const result = await refreshToken.handleOAuthUserInfo(ctx, {
431
455
  userInfo: {
432
456
  ...userInfo,
433
457
  ...mapUser
@@ -458,7 +482,7 @@ const genericOAuth = (options) => {
458
482
  throw ctx.redirect(toRedirectTo);
459
483
  }
460
484
  ),
461
- oAuth2LinkAccount: account.createAuthEndpoint(
485
+ oAuth2LinkAccount: refreshToken.createAuthEndpoint(
462
486
  "/oauth2/link",
463
487
  {
464
488
  method: "POST",
@@ -466,19 +490,19 @@ const genericOAuth = (options) => {
466
490
  providerId: zod.z.string(),
467
491
  callbackURL: zod.z.string()
468
492
  }),
469
- use: [account.sessionMiddleware]
493
+ use: [refreshToken.sessionMiddleware]
470
494
  },
471
495
  async (c) => {
472
496
  const session = c.context.session;
473
- const account$1 = await c.context.internalAdapter.findAccounts(
497
+ const account = await c.context.internalAdapter.findAccounts(
474
498
  session.user.id
475
499
  );
476
- const existingAccount = account$1.find(
500
+ const existingAccount = account.find(
477
501
  (a) => a.providerId === c.body.providerId
478
502
  );
479
503
  if (existingAccount) {
480
504
  throw new betterCall.APIError("BAD_REQUEST", {
481
- message: account.BASE_ERROR_CODES.SOCIAL_ACCOUNT_ALREADY_LINKED
505
+ message: refreshToken.BASE_ERROR_CODES.SOCIAL_ACCOUNT_ALREADY_LINKED
482
506
  });
483
507
  }
484
508
  const provider = options.config.find(
@@ -486,7 +510,7 @@ const genericOAuth = (options) => {
486
510
  );
487
511
  if (!provider) {
488
512
  throw new betterCall.APIError("NOT_FOUND", {
489
- message: account.BASE_ERROR_CODES.PROVIDER_NOT_FOUND
513
+ message: refreshToken.BASE_ERROR_CODES.PROVIDER_NOT_FOUND
490
514
  });
491
515
  }
492
516
  const {
@@ -529,7 +553,7 @@ const genericOAuth = (options) => {
529
553
  userId: session.user.id,
530
554
  email: session.user.email
531
555
  });
532
- const url = await validateAuthorizationCode.createAuthorizationURL({
556
+ const url = await refreshAccessToken.createAuthorizationURL({
533
557
  id: providerId,
534
558
  options: {
535
559
  clientId,
@@ -1,7 +1,7 @@
1
1
  import * as better_call from 'better-call';
2
2
  import { z } from 'zod';
3
- import { U as User, l as AuthContext } from '../../shared/better-auth.CxMUffeh.cjs';
4
- import { O as OAuth2Tokens, a as OAuthProvider } from '../../shared/better-auth.CzK7QJBv.cjs';
3
+ import { U as User, l as AuthContext } from '../../shared/better-auth.BDAwKjlL.cjs';
4
+ import { O as OAuth2Tokens, a as OAuthProvider } from '../../shared/better-auth.CH6fRG6d.cjs';
5
5
  import '../../shared/better-auth.Bi8FQwDD.cjs';
6
6
  import 'kysely';
7
7
  import 'better-sqlite3';
@@ -112,8 +112,8 @@ interface GenericOAuthConfig {
112
112
  */
113
113
  disableSignUp?: boolean;
114
114
  /**
115
- * Allows to use basic authentication for the token endpoint.
116
- * Default is "post".
115
+ * Authentication method for token requests.
116
+ * @default "post"
117
117
  */
118
118
  authentication?: "basic" | "post";
119
119
  }
@@ -1,7 +1,7 @@
1
1
  import * as better_call from 'better-call';
2
2
  import { z } from 'zod';
3
- import { U as User, l as AuthContext } from '../../shared/better-auth.dzwyqpra.mjs';
4
- import { O as OAuth2Tokens, a as OAuthProvider } from '../../shared/better-auth.BjoUuJNr.mjs';
3
+ import { U as User, l as AuthContext } from '../../shared/better-auth.CTQDLJN7.mjs';
4
+ import { O as OAuth2Tokens, a as OAuthProvider } from '../../shared/better-auth.BTnAiI8e.mjs';
5
5
  import '../../shared/better-auth.Bi8FQwDD.mjs';
6
6
  import 'kysely';
7
7
  import 'better-sqlite3';
@@ -112,8 +112,8 @@ interface GenericOAuthConfig {
112
112
  */
113
113
  disableSignUp?: boolean;
114
114
  /**
115
- * Allows to use basic authentication for the token endpoint.
116
- * Default is "post".
115
+ * Authentication method for token requests.
116
+ * @default "post"
117
117
  */
118
118
  authentication?: "basic" | "post";
119
119
  }
@@ -1,7 +1,7 @@
1
1
  import * as better_call from 'better-call';
2
2
  import { z } from 'zod';
3
- import { U as User, l as AuthContext } from '../../shared/better-auth.CixnJ90x.js';
4
- import { O as OAuth2Tokens, a as OAuthProvider } from '../../shared/better-auth.Dd96RDNl.js';
3
+ import { U as User, l as AuthContext } from '../../shared/better-auth.tpz8D0AA.js';
4
+ import { O as OAuth2Tokens, a as OAuthProvider } from '../../shared/better-auth.BAfIsot3.js';
5
5
  import '../../shared/better-auth.Bi8FQwDD.js';
6
6
  import 'kysely';
7
7
  import 'better-sqlite3';
@@ -112,8 +112,8 @@ interface GenericOAuthConfig {
112
112
  */
113
113
  disableSignUp?: boolean;
114
114
  /**
115
- * Allows to use basic authentication for the token endpoint.
116
- * Default is "post".
115
+ * Authentication method for token requests.
116
+ * @default "post"
117
117
  */
118
118
  authentication?: "basic" | "post";
119
119
  }