@better-auth/core 1.4.12-beta.1 → 1.4.12-beta.2

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
1
 
2
- > @better-auth/core@1.4.12-beta.1 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.12-beta.2 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.17.2 powered by rolldown v1.0.0-beta.53
@@ -19,7 +19,7 @@
19
19
  ℹ dist/utils/index.mjs  0.26 kB │ gzip: 0.18 kB
20
20
  ℹ dist/error/index.mjs  0.19 kB │ gzip: 0.14 kB
21
21
  ℹ dist/index.mjs  0.01 kB │ gzip: 0.03 kB
22
- ℹ dist/oauth2-BjWM15hm.mjs  12.82 kB │ gzip: 3.16 kB
22
+ ℹ dist/oauth2-COJkghlT.mjs  12.86 kB │ gzip: 3.16 kB
23
23
  ℹ dist/env-DbssmzoK.mjs  7.67 kB │ gzip: 2.54 kB
24
24
  ℹ dist/get-tables-CMc_Emww.mjs  6.76 kB │ gzip: 1.30 kB
25
25
  ℹ dist/context-BGZ8V6DD.mjs  4.46 kB │ gzip: 1.10 kB
@@ -37,7 +37,7 @@
37
37
  ℹ dist/api/index.d.mts  0.26 kB │ gzip: 0.14 kB
38
38
  ℹ dist/async_hooks/index.d.mts  0.24 kB │ gzip: 0.16 kB
39
39
  ℹ dist/async_hooks/pure.index.d.mts  0.22 kB │ gzip: 0.16 kB
40
- ℹ dist/index-BHaoMSKV.d.mts 227.72 kB │ gzip: 35.92 kB
40
+ ℹ dist/index-zgYuzZ7O.d.mts 227.98 kB │ gzip: 36.00 kB
41
41
  ℹ dist/index-BRBu0-5h.d.mts  3.31 kB │ gzip: 1.11 kB
42
- ℹ 32 files, total: 410.48 kB
43
- ✔ Build complete in 5348ms
42
+ ℹ 32 files, total: 410.77 kB
43
+ ✔ Build complete in 5142ms
@@ -1,2 +1,2 @@
1
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-BHaoMSKV.mjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-zgYuzZ7O.mjs";
2
2
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,4 +1,4 @@
1
- import { Xn as DBAdapter, f as AuthContext, tr as DBTransactionAdapter } from "../index-BHaoMSKV.mjs";
1
+ import { Xn as DBAdapter, f as AuthContext, tr as DBTransactionAdapter } from "../index-zgYuzZ7O.mjs";
2
2
  import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
3
3
  import { EndpointContext, InputContext } from "better-call";
4
4
 
@@ -1,2 +1,2 @@
1
- import { $n as DBAdapterInstance, Cr as initGetIdField, Dr as initGetDefaultFieldName, Er as initGetDefaultModelName, Jn as CleanedWhere, Qn as DBAdapterFactoryConfig, Sr as initGetModelName, Tr as initGetFieldAttributes, Xn as DBAdapter, Yn as CustomAdapter, Zn as DBAdapterDebugLogOption, ar as deepmerge, cr as createAdapter, dr as AdapterFactoryConfig, er as DBAdapterSchemaCreation, fr as AdapterFactoryCustomizeAdapterCreator, gr as CreateCustomAdapter, hr as CreateAdapterOptions, ir as Where, lr as createAdapterFactory, mr as AdapterTestDebugLogs, nr as JoinConfig, or as withApplyDefault, pr as AdapterFactoryOptions, rr as JoinOption, sr as AdapterFactory, tr as DBTransactionAdapter, ur as AdapterConfig, wr as initGetFieldName } from "../../index-BHaoMSKV.mjs";
1
+ import { $n as DBAdapterInstance, Cr as initGetIdField, Dr as initGetDefaultFieldName, Er as initGetDefaultModelName, Jn as CleanedWhere, Qn as DBAdapterFactoryConfig, Sr as initGetModelName, Tr as initGetFieldAttributes, Xn as DBAdapter, Yn as CustomAdapter, Zn as DBAdapterDebugLogOption, ar as deepmerge, cr as createAdapter, dr as AdapterFactoryConfig, er as DBAdapterSchemaCreation, fr as AdapterFactoryCustomizeAdapterCreator, gr as CreateCustomAdapter, hr as CreateAdapterOptions, ir as Where, lr as createAdapterFactory, mr as AdapterTestDebugLogs, nr as JoinConfig, or as withApplyDefault, pr as AdapterFactoryOptions, rr as JoinOption, sr as AdapterFactory, tr as DBTransactionAdapter, ur as AdapterConfig, wr as initGetFieldName } from "../../index-zgYuzZ7O.mjs";
2
2
  export { AdapterConfig, AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CleanedWhere, CreateAdapterOptions, CreateCustomAdapter, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where, createAdapter, createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, withApplyDefault };
@@ -1,2 +1,2 @@
1
- import { Ar as User, Br as getAuthTables, Fr as RateLimit, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as rateLimitSchema, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as Account, Mr as coreSchema, Nr as Session, Or as Verification, Pr as sessionSchema, Rr as accountSchema, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as userSchema, kr as verificationSchema, qr as ModelNames, zr as BetterAuthPluginDBSchema } from "../index-BHaoMSKV.mjs";
1
+ import { Ar as User, Br as getAuthTables, Fr as RateLimit, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as rateLimitSchema, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as Account, Mr as coreSchema, Nr as Session, Or as Verification, Pr as sessionSchema, Rr as accountSchema, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as userSchema, kr as verificationSchema, qr as ModelNames, zr as BetterAuthPluginDBSchema } from "../index-zgYuzZ7O.mjs";
2
2
  export { Account, BaseModelNames, BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, ModelNames, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
@@ -1121,6 +1121,12 @@ type ProviderOptions<Profile$1 extends Record<string, any> = any> = {
1121
1121
  * whitelisted in the provider's dashboard.
1122
1122
  */
1123
1123
  redirectURI?: string | undefined;
1124
+ /**
1125
+ * Custom authorization endpoint URL.
1126
+ * Use this to override the default authorization endpoint of the provider.
1127
+ * Useful for testing with local OAuth servers or using sandbox environments.
1128
+ */
1129
+ authorizationEndpoint?: string | undefined;
1124
1130
  /**
1125
1131
  * The client key of your application
1126
1132
  * Tiktok Social Provider uses this field instead of clientId
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { An as BetterAuthCookies, _ as BetterAuthOptions, _r as Awaitable, b as BetterAuthPlugin, br as Prettify, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthAdvancedOptions, h as PluginContext, l as ClientAtomListener, m as InternalAdapter, o as StandardSchemaV1, p as GenericEndpointContext, s as BetterAuthClientOptions, u as ClientFetchOption, v as BetterAuthRateLimitOptions, vr as LiteralString, x as HookEndpointContext, xr as Primitive, y as GenerateIdFn, yr as LiteralUnion } from "./index-BHaoMSKV.mjs";
1
+ import { An as BetterAuthCookies, _ as BetterAuthOptions, _r as Awaitable, b as BetterAuthPlugin, br as Prettify, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthAdvancedOptions, h as PluginContext, l as ClientAtomListener, m as InternalAdapter, o as StandardSchemaV1, p as GenericEndpointContext, s as BetterAuthClientOptions, u as ClientFetchOption, v as BetterAuthRateLimitOptions, vr as LiteralString, x as HookEndpointContext, xr as Primitive, y as GenerateIdFn, yr as LiteralUnion } from "./index-zgYuzZ7O.mjs";
2
2
  export { AuthContext, Awaitable, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, PluginContext, Prettify, Primitive, StandardSchemaV1 };
@@ -1,2 +1,2 @@
1
- import { Bn as refreshAccessToken, Fn as validateAuthorizationCode, Gn as OAuth2UserInfo, Hn as clientCredentialsToken, In as validateToken, Kn as OAuthProvider, Ln as generateCodeChallenge, Mn as verifyAccessToken, Nn as verifyJwsAccessToken, Pn as createAuthorizationCodeRequest, Rn as getOAuth2Tokens, Un as createClientCredentialsTokenRequest, Vn as createAuthorizationURL, Wn as OAuth2Tokens, jn as getJwks, qn as ProviderOptions, zn as createRefreshAccessTokenRequest } from "../index-BHaoMSKV.mjs";
1
+ import { Bn as refreshAccessToken, Fn as validateAuthorizationCode, Gn as OAuth2UserInfo, Hn as clientCredentialsToken, In as validateToken, Kn as OAuthProvider, Ln as generateCodeChallenge, Mn as verifyAccessToken, Nn as verifyJwsAccessToken, Pn as createAuthorizationCodeRequest, Rn as getOAuth2Tokens, Un as createClientCredentialsTokenRequest, Vn as createAuthorizationURL, Wn as OAuth2Tokens, jn as getJwks, qn as ProviderOptions, zn as createRefreshAccessTokenRequest } from "../index-zgYuzZ7O.mjs";
2
2
  export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getJwks, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken, verifyAccessToken, verifyJwsAccessToken };
@@ -1,4 +1,4 @@
1
1
  import "../env-DbssmzoK.mjs";
2
- import { a as validateAuthorizationCode, c as refreshAccessToken, d as getOAuth2Tokens, f as clientCredentialsToken, i as createAuthorizationCodeRequest, l as createAuthorizationURL, n as verifyAccessToken, o as validateToken, p as createClientCredentialsTokenRequest, r as verifyJwsAccessToken, s as createRefreshAccessTokenRequest, t as getJwks, u as generateCodeChallenge } from "../oauth2-BjWM15hm.mjs";
2
+ import { a as validateAuthorizationCode, c as refreshAccessToken, d as getOAuth2Tokens, f as clientCredentialsToken, i as createAuthorizationCodeRequest, l as createAuthorizationURL, n as verifyAccessToken, o as validateToken, p as createClientCredentialsTokenRequest, r as verifyJwsAccessToken, s as createRefreshAccessTokenRequest, t as getJwks, u as generateCodeChallenge } from "../oauth2-COJkghlT.mjs";
3
3
 
4
4
  export { clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getJwks, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken, verifyAccessToken, verifyJwsAccessToken };
@@ -80,7 +80,7 @@ async function generateCodeChallenge(codeVerifier) {
80
80
  //#endregion
81
81
  //#region src/oauth2/create-authorization-url.ts
82
82
  async function createAuthorizationURL({ id, options, authorizationEndpoint, state, codeVerifier, scopes, claims, redirectURI, duration, prompt, accessType, responseType, display, loginHint, hd, responseMode, additionalParams, scopeJoiner }) {
83
- const url = new URL(authorizationEndpoint);
83
+ const url = new URL(options.authorizationEndpoint || authorizationEndpoint);
84
84
  url.searchParams.set("response_type", responseType || "code");
85
85
  const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
86
86
  url.searchParams.set("client_id", primaryClientId);
@@ -1,2 +1,2 @@
1
- import { $ as notion, $t as GoogleOptions, A as vercel, At as LinearUser, B as paybin, Bt as twitter, C as SocialProviderList, Cn as AtlassianProfile, Ct as GitlabProfile, D as socialProviders, Dn as AppleProfile, Dt as linkedin, E as socialProviderList, En as AppleOptions, Et as LinkedInProfile, F as PayPalProfile, Ft as DropboxOptions, G as NaverOptions, Gt as SpotifyProfile, H as LineOptions, Ht as TwitchProfile, I as PayPalTokenResponse, It as DropboxProfile, J as KakaoOptions, Jt as SlackProfile, K as NaverProfile, Kt as spotify, L as paypal, Lt as dropbox, M as PolarProfile, Mt as KickOptions, N as polar, Nt as KickProfile, O as VercelOptions, On as apple, Ot as LinearOptions, P as PayPalOptions, Pt as kick, Q as NotionProfile, Qt as huggingface, R as PaybinOptions, Rt as TwitterOption, S as SocialProvider, Sn as AtlassianOptions, St as GitlabOptions, T as SocialProviders, Tn as AppleNonConformUser, Tt as LinkedInOptions, U as LineUserInfo, Ut as twitch, V as LineIdTokenPayload, Vt as TwitchOptions, W as line, Wt as SpotifyOptions, X as kakao, Xt as HuggingFaceOptions, Y as KakaoProfile, Yt as slack, Z as NotionOptions, Zt as HuggingFaceProfile, _n as discord, _t as RedditProfile, an as microsoft, at as ZoomProfile, bn as cognito, bt as TiktokProfile, cn as github, ct as VkProfile, dn as figma, dt as SalesforceProfile, en as GoogleProfile, et as AccountStatus, fn as FacebookOptions, ft as salesforce, gn as DiscordProfile, gt as RedditOptions, hn as DiscordOptions, ht as roblox, in as MicrosoftOptions, it as ZoomOptions, j as PolarOptions, jt as linear, k as VercelProfile, kn as getApplePublicKey, kt as LinearProfile, ln as FigmaOptions, lt as vk, mn as facebook, mt as RobloxProfile, nn as google, nt as PhoneNumber, on as GithubOptions, ot as zoom, pn as FacebookProfile, pt as RobloxOptions, q as naver, qt as SlackOptions, rn as MicrosoftEntraIDProfile, rt as PronounOption, sn as GithubProfile, st as VkOption, tn as getGooglePublicKey, tt as LoginType, un as FigmaProfile, ut as SalesforceOptions, vn as CognitoOptions, vt as reddit, w as SocialProviderListEnum, wn as atlassian, wt as gitlab, xn as getCognitoPublicKey, xt as tiktok, yn as CognitoProfile, yt as TiktokOptions, z as PaybinProfile, zt as TwitterProfile } from "../index-BHaoMSKV.mjs";
1
+ import { $ as notion, $t as GoogleOptions, A as vercel, At as LinearUser, B as paybin, Bt as twitter, C as SocialProviderList, Cn as AtlassianProfile, Ct as GitlabProfile, D as socialProviders, Dn as AppleProfile, Dt as linkedin, E as socialProviderList, En as AppleOptions, Et as LinkedInProfile, F as PayPalProfile, Ft as DropboxOptions, G as NaverOptions, Gt as SpotifyProfile, H as LineOptions, Ht as TwitchProfile, I as PayPalTokenResponse, It as DropboxProfile, J as KakaoOptions, Jt as SlackProfile, K as NaverProfile, Kt as spotify, L as paypal, Lt as dropbox, M as PolarProfile, Mt as KickOptions, N as polar, Nt as KickProfile, O as VercelOptions, On as apple, Ot as LinearOptions, P as PayPalOptions, Pt as kick, Q as NotionProfile, Qt as huggingface, R as PaybinOptions, Rt as TwitterOption, S as SocialProvider, Sn as AtlassianOptions, St as GitlabOptions, T as SocialProviders, Tn as AppleNonConformUser, Tt as LinkedInOptions, U as LineUserInfo, Ut as twitch, V as LineIdTokenPayload, Vt as TwitchOptions, W as line, Wt as SpotifyOptions, X as kakao, Xt as HuggingFaceOptions, Y as KakaoProfile, Yt as slack, Z as NotionOptions, Zt as HuggingFaceProfile, _n as discord, _t as RedditProfile, an as microsoft, at as ZoomProfile, bn as cognito, bt as TiktokProfile, cn as github, ct as VkProfile, dn as figma, dt as SalesforceProfile, en as GoogleProfile, et as AccountStatus, fn as FacebookOptions, ft as salesforce, gn as DiscordProfile, gt as RedditOptions, hn as DiscordOptions, ht as roblox, in as MicrosoftOptions, it as ZoomOptions, j as PolarOptions, jt as linear, k as VercelProfile, kn as getApplePublicKey, kt as LinearProfile, ln as FigmaOptions, lt as vk, mn as facebook, mt as RobloxProfile, nn as google, nt as PhoneNumber, on as GithubOptions, ot as zoom, pn as FacebookProfile, pt as RobloxOptions, q as naver, qt as SlackOptions, rn as MicrosoftEntraIDProfile, rt as PronounOption, sn as GithubProfile, st as VkOption, tn as getGooglePublicKey, tt as LoginType, un as FigmaProfile, ut as SalesforceOptions, vn as CognitoOptions, vt as reddit, w as SocialProviderListEnum, wn as atlassian, wt as gitlab, xn as getCognitoPublicKey, xt as tiktok, yn as CognitoProfile, yt as TiktokOptions, z as PaybinProfile, zt as TwitterProfile } from "../index-zgYuzZ7O.mjs";
2
2
  export { AccountStatus, AppleNonConformUser, AppleOptions, AppleProfile, AtlassianOptions, AtlassianProfile, CognitoOptions, CognitoProfile, DiscordOptions, DiscordProfile, DropboxOptions, DropboxProfile, FacebookOptions, FacebookProfile, FigmaOptions, FigmaProfile, GithubOptions, GithubProfile, GitlabOptions, GitlabProfile, GoogleOptions, GoogleProfile, HuggingFaceOptions, HuggingFaceProfile, KakaoOptions, KakaoProfile, KickOptions, KickProfile, LineIdTokenPayload, LineOptions, LineUserInfo, LinearOptions, LinearProfile, LinearUser, LinkedInOptions, LinkedInProfile, LoginType, MicrosoftEntraIDProfile, MicrosoftOptions, NaverOptions, NaverProfile, NotionOptions, NotionProfile, PayPalOptions, PayPalProfile, PayPalTokenResponse, PaybinOptions, PaybinProfile, PhoneNumber, PolarOptions, PolarProfile, PronounOption, RedditOptions, RedditProfile, RobloxOptions, RobloxProfile, SalesforceOptions, SalesforceProfile, SlackOptions, SlackProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, SpotifyOptions, SpotifyProfile, TiktokOptions, TiktokProfile, TwitchOptions, TwitchProfile, TwitterOption, TwitterProfile, VercelOptions, VercelProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, getGooglePublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vercel, vk, zoom };
@@ -1,7 +1,7 @@
1
1
  import { i as logger } from "../env-DbssmzoK.mjs";
2
2
  import "../utils-U2L7n92V.mjs";
3
3
  import { t as BetterAuthError } from "../error-DP1xOn7P.mjs";
4
- import { a as validateAuthorizationCode, c as refreshAccessToken, d as getOAuth2Tokens, l as createAuthorizationURL, u as generateCodeChallenge } from "../oauth2-BjWM15hm.mjs";
4
+ import { a as validateAuthorizationCode, c as refreshAccessToken, d as getOAuth2Tokens, l as createAuthorizationURL, u as generateCodeChallenge } from "../oauth2-COJkghlT.mjs";
5
5
  import * as z from "zod";
6
6
  import { base64 } from "@better-auth/utils/base64";
7
7
  import { betterFetch } from "@better-fetch/fetch";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.4.12-beta.1",
3
+ "version": "1.4.12-beta.2",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -40,7 +40,7 @@ export async function createAuthorizationURL({
40
40
  additionalParams?: Record<string, string> | undefined;
41
41
  scopeJoiner?: string | undefined;
42
42
  }) {
43
- const url = new URL(authorizationEndpoint);
43
+ const url = new URL(options.authorizationEndpoint || authorizationEndpoint);
44
44
  url.searchParams.set("response_type", responseType || "code");
45
45
  const primaryClientId = Array.isArray(options.clientId)
46
46
  ? options.clientId[0]
@@ -119,6 +119,12 @@ export type ProviderOptions<Profile extends Record<string, any> = any> = {
119
119
  * whitelisted in the provider's dashboard.
120
120
  */
121
121
  redirectURI?: string | undefined;
122
+ /**
123
+ * Custom authorization endpoint URL.
124
+ * Use this to override the default authorization endpoint of the provider.
125
+ * Useful for testing with local OAuth servers or using sandbox environments.
126
+ */
127
+ authorizationEndpoint?: string | undefined;
122
128
  /**
123
129
  * The client key of your application
124
130
  * Tiktok Social Provider uses this field instead of clientId