@ascendkit/nextjs 0.2.7 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AscendKitAuth, createAscendKitAuthRuntime, createAscendKitAdapter, createAccessTokenHandler, Analytics, } from "./server";
1
+ export { AscendKitAuth, createAscendKitAuthRuntime, createAuthRouteHandlers, createAscendKitAdapter, createAccessTokenHandler, Analytics, } from "./server";
2
2
  export type { AscendKitAuthOptions, AscendKitSession, AscendKitUser, BrandingConfig } from "./shared/types";
3
3
  export { AscendKitProvider, useAscendKitContext, useAscendKit, useAuthModal, useAccessToken, useSessions, useUser, useAnalytics, verifyEmail } from "./client";
4
4
  export { Login, SignUp, EmailVerification, ForgotPassword, ResetPassword, SocialButton, AscendKitAuthCard, AuthModal, SignInButton, SignUpButton, AscendKitUserButton, type AscendKitUserButtonProps, BrandingBadge, } from "./components";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG5G,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG/J,OAAO,EACL,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG5G,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG/J,OAAO,EACL,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Server
2
- export { AscendKitAuth, createAscendKitAuthRuntime, createAscendKitAdapter, createAccessTokenHandler, Analytics, } from "./server";
2
+ export { AscendKitAuth, createAscendKitAuthRuntime, createAuthRouteHandlers, createAscendKitAdapter, createAccessTokenHandler, Analytics, } from "./server";
3
3
  // Client
4
4
  export { AscendKitProvider, useAscendKitContext, useAscendKit, useAuthModal, useAccessToken, useSessions, useUser, useAnalytics, verifyEmail } from "./client";
5
5
  // Components
@@ -8,7 +8,7 @@ interface AccessTokenHandlerOptions {
8
8
  apiUrl?: string;
9
9
  }
10
10
  /**
11
- * Create a Next.js route handler that exchanges a Better Auth session
11
+ * Create a Next.js route handler that exchanges an AscendKit auth session
12
12
  * for a short-lived RS256 access token.
13
13
  *
14
14
  * The access token can be verified by any backend using AscendKit's JWKS
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_API_URL } from "../shared/constants";
2
2
  /**
3
- * Create a Next.js route handler that exchanges a Better Auth session
3
+ * Create a Next.js route handler that exchanges an AscendKit auth session
4
4
  * for a short-lived RS256 access token.
5
5
  *
6
6
  * The access token can be verified by any backend using AscendKit's JWKS
@@ -36,7 +36,7 @@ export function createAccessTokenHandler(options) {
36
36
  error: "Server misconfiguration: missing AscendKit public key in createAccessTokenHandler",
37
37
  }, { status: 500 });
38
38
  }
39
- // Read session via Better Auth (handles cookies internally)
39
+ // Read session via the AscendKit auth runtime (handles cookies internally)
40
40
  let session;
41
41
  try {
42
42
  session = await authRuntime.getSession(req.headers);
@@ -1,14 +1,14 @@
1
1
  import type { AscendKitAuthOptions, AuthConfig } from "../shared/types";
2
2
  import type { BetterAuthPlugin } from "better-auth";
3
3
  /**
4
- * Pre-configured Better Auth setup for AscendKit.
4
+ * Pre-configured auth setup for AscendKit.
5
5
  *
6
6
  * NOTE: This helper builds a static auth instance. For runtime hot-reload
7
7
  * behavior (no server restarts when auth settings change), use
8
8
  * createAscendKitAuthRuntime() instead.
9
9
  *
10
10
  * Fetches auth config (enabled providers, OAuth credentials, features)
11
- * from the AscendKit backend and returns a fully configured Better Auth instance.
11
+ * from the AscendKit backend and returns a fully configured auth instance.
12
12
  * Email callbacks route through AscendKit's content service + SES for delivery.
13
13
  *
14
14
  * Usage:
@@ -26,15 +26,22 @@ import type { BetterAuthPlugin } from "better-auth";
26
26
  * ```ts
27
27
  * // app/api/auth/[...all]/route.ts
28
28
  * import { auth } from "@/lib/auth";
29
- * import { toNextJsHandler } from "@ascendkit/nextjs/server";
30
- * export const { GET, POST } = toNextJsHandler(auth.handler);
29
+ * import { createAuthRouteHandlers } from "@ascendkit/nextjs/server";
30
+ * export const { GET, POST } = createAuthRouteHandlers(auth);
31
31
  * ```
32
32
  */
33
33
  export declare function AscendKitAuth(options?: AscendKitAuthOptions): Promise<import("better-auth").Auth<{
34
+ baseURL: string | {
35
+ allowedHosts: string[];
36
+ fallback?: string;
37
+ } | undefined;
34
38
  database: import("better-auth/adapters").AdapterFactory<import("better-auth").BetterAuthOptions>;
35
39
  emailAndPassword: {
36
40
  enabled: false;
37
41
  };
42
+ advanced: {
43
+ trustedProxyHeaders: boolean | undefined;
44
+ };
38
45
  }> | import("better-auth").Auth<{
39
46
  plugins?: BetterAuthPlugin[] | undefined;
40
47
  socialProviders: Record<string, {
@@ -48,6 +55,9 @@ export declare function AscendKitAuth(options?: AscendKitAuthOptions): Promise<i
48
55
  maxAge: number;
49
56
  };
50
57
  };
58
+ advanced: {
59
+ trustedProxyHeaders: boolean | undefined;
60
+ };
51
61
  emailVerification?: {
52
62
  sendVerificationEmail: (data: {
53
63
  user: {
@@ -58,6 +68,10 @@ export declare function AscendKitAuth(options?: AscendKitAuthOptions): Promise<i
58
68
  }) => Promise<void>;
59
69
  sendOnSignUp: boolean;
60
70
  } | undefined;
71
+ baseURL: string | {
72
+ allowedHosts: string[];
73
+ fallback?: string;
74
+ } | undefined;
61
75
  database: import("better-auth/adapters").AdapterFactory<import("better-auth").BetterAuthOptions>;
62
76
  emailAndPassword: {
63
77
  sendResetPassword?: ((data: {
@@ -71,17 +85,27 @@ export declare function AscendKitAuth(options?: AscendKitAuthOptions): Promise<i
71
85
  enabled: boolean;
72
86
  };
73
87
  }>>;
74
- export declare function createDisabledAuth(publicKey: string, apiUrl: string, secretKey?: string): import("better-auth").Auth<{
88
+ export declare function createDisabledAuth(publicKey: string, apiUrl: string, secretKey?: string, options?: Pick<AscendKitAuthOptions, "appBaseUrl" | "allowedHosts" | "trustedProxyHeaders">): import("better-auth").Auth<{
89
+ baseURL: string | {
90
+ allowedHosts: string[];
91
+ fallback?: string;
92
+ } | undefined;
75
93
  database: import("better-auth/adapters").AdapterFactory<import("better-auth").BetterAuthOptions>;
76
94
  emailAndPassword: {
77
95
  enabled: false;
78
96
  };
97
+ advanced: {
98
+ trustedProxyHeaders: boolean | undefined;
99
+ };
79
100
  }>;
80
101
  export declare function buildAscendKitAuthFromConfig(args: {
81
102
  publicKey: string;
82
103
  secretKey?: string;
83
104
  apiUrl: string;
84
105
  config: AuthConfig;
106
+ appBaseUrl?: string;
107
+ allowedHosts?: string[];
108
+ trustedProxyHeaders?: boolean;
85
109
  waitlistRedirectPath?: string;
86
110
  rejectedRedirectPath?: string;
87
111
  }): Promise<import("better-auth").Auth<{
@@ -97,6 +121,9 @@ export declare function buildAscendKitAuthFromConfig(args: {
97
121
  maxAge: number;
98
122
  };
99
123
  };
124
+ advanced: {
125
+ trustedProxyHeaders: boolean | undefined;
126
+ };
100
127
  emailVerification?: {
101
128
  sendVerificationEmail: (data: {
102
129
  user: {
@@ -107,6 +134,10 @@ export declare function buildAscendKitAuthFromConfig(args: {
107
134
  }) => Promise<void>;
108
135
  sendOnSignUp: boolean;
109
136
  } | undefined;
137
+ baseURL: string | {
138
+ allowedHosts: string[];
139
+ fallback?: string;
140
+ } | undefined;
110
141
  database: import("better-auth/adapters").AdapterFactory<import("better-auth").BetterAuthOptions>;
111
142
  emailAndPassword: {
112
143
  sendResetPassword?: ((data: {
@@ -1 +1 @@
1
- {"version":3,"file":"ascendkit-auth.d.ts","sourceRoot":"","sources":["../../src/server/ascendkit-auth.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,oBAAyB;;;;;;;;;;;;;;;;;;;sCA0G1B;YAAE,IAAI,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,GAAG,E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E,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE;;;;;;;;;oCARxD;YAAE,IAAI,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE;;;;IAhG/F;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,YAAY,GAAG,cAAc,GAAG,qBAAqB,CAAM;;;;;;;;;;;;GAWhG;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;;;;;;;;;;;;;;;;;sCA2E2C;YAAE,IAAI,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE;;;;;;;;;oCARxD;YAAE,IAAI,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE;;;;IA2B/F"}
@@ -5,15 +5,16 @@ import { buildSocialProviders } from "./social-providers";
5
5
  import { createEmailSender } from "./email-sender";
6
6
  import { ascendkitOAuthProxyPlugin } from "./oauth-proxy-plugin";
7
7
  import { DEFAULT_API_URL } from "../shared/constants";
8
+ import { resolveAscendKitBaseUrlConfig } from "./base-url";
8
9
  /**
9
- * Pre-configured Better Auth setup for AscendKit.
10
+ * Pre-configured auth setup for AscendKit.
10
11
  *
11
12
  * NOTE: This helper builds a static auth instance. For runtime hot-reload
12
13
  * behavior (no server restarts when auth settings change), use
13
14
  * createAscendKitAuthRuntime() instead.
14
15
  *
15
16
  * Fetches auth config (enabled providers, OAuth credentials, features)
16
- * from the AscendKit backend and returns a fully configured Better Auth instance.
17
+ * from the AscendKit backend and returns a fully configured auth instance.
17
18
  * Email callbacks route through AscendKit's content service + SES for delivery.
18
19
  *
19
20
  * Usage:
@@ -31,8 +32,8 @@ import { DEFAULT_API_URL } from "../shared/constants";
31
32
  * ```ts
32
33
  * // app/api/auth/[...all]/route.ts
33
34
  * import { auth } from "@/lib/auth";
34
- * import { toNextJsHandler } from "@ascendkit/nextjs/server";
35
- * export const { GET, POST } = toNextJsHandler(auth.handler);
35
+ * import { createAuthRouteHandlers } from "@ascendkit/nextjs/server";
36
+ * export const { GET, POST } = createAuthRouteHandlers(auth);
36
37
  * ```
37
38
  */
38
39
  export async function AscendKitAuth(options = {}) {
@@ -46,26 +47,33 @@ export async function AscendKitAuth(options = {}) {
46
47
  catch (err) {
47
48
  console.error("[AscendKit] Failed to fetch auth config:", err instanceof Error ? err.message : err);
48
49
  console.error("[AscendKit] Auth routes will operate with no providers until config is available.");
49
- return createDisabledAuth(publicKey, apiUrl, secretKey);
50
+ return createDisabledAuth(publicKey, apiUrl, secretKey, options);
50
51
  }
51
52
  return buildAscendKitAuthFromConfig({
52
53
  publicKey,
53
54
  secretKey,
54
55
  apiUrl,
55
56
  config,
57
+ appBaseUrl: options.appBaseUrl,
58
+ allowedHosts: options.allowedHosts,
59
+ trustedProxyHeaders: options.trustedProxyHeaders,
56
60
  waitlistRedirectPath: options.waitlistRedirectPath,
57
61
  rejectedRedirectPath: options.rejectedRedirectPath,
58
62
  });
59
63
  }
60
- export function createDisabledAuth(publicKey, apiUrl, secretKey) {
64
+ export function createDisabledAuth(publicKey, apiUrl, secretKey, options = {}) {
61
65
  const adapter = createAscendKitAdapter(publicKey, apiUrl, secretKey);
62
66
  return betterAuth({
67
+ baseURL: resolveAscendKitBaseUrlConfig(options),
63
68
  database: adapter,
64
69
  emailAndPassword: { enabled: false },
70
+ advanced: {
71
+ trustedProxyHeaders: options.trustedProxyHeaders,
72
+ },
65
73
  });
66
74
  }
67
75
  export async function buildAscendKitAuthFromConfig(args) {
68
- const { publicKey, secretKey, apiUrl, config, waitlistRedirectPath, rejectedRedirectPath, } = args;
76
+ const { publicKey, secretKey, apiUrl, config, appBaseUrl, allowedHosts, trustedProxyHeaders, waitlistRedirectPath, rejectedRedirectPath, } = args;
69
77
  const adapter = createAscendKitAdapter(publicKey, apiUrl, secretKey);
70
78
  const proxyProviders = Object.entries(config.oauth)
71
79
  .filter(([, creds]) => creds.flowType === "proxy")
@@ -102,6 +110,11 @@ export async function buildAscendKitAuthFromConfig(args) {
102
110
  const sessionMaxAge = parseSessionDuration(config.sessionDuration);
103
111
  const credentialsEnabled = config.providers.includes("credentials") && !magicLinkEnabled;
104
112
  return betterAuth({
113
+ baseURL: resolveAscendKitBaseUrlConfig({
114
+ appBaseUrl,
115
+ allowedHosts,
116
+ trustedProxyHeaders,
117
+ }),
105
118
  database: adapter,
106
119
  emailAndPassword: {
107
120
  enabled: credentialsEnabled,
@@ -130,6 +143,9 @@ export async function buildAscendKitAuthFromConfig(args) {
130
143
  maxAge: 5 * 60, // 5 minutes — auth'd requests skip the adapter
131
144
  },
132
145
  },
146
+ advanced: {
147
+ trustedProxyHeaders,
148
+ },
133
149
  ...(plugins.length > 0 && { plugins }),
134
150
  });
135
151
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth-runtime.d.ts","sourceRoot":"","sources":["../../src/server/auth-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA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;AA8BD,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,oBAAyB,GAAG,oBAAoB,CA8HnG"}
@@ -52,14 +52,14 @@ export function createAscendKitAuthRuntime(options = {}) {
52
52
  }
53
53
  console.info("[AscendKit runtime] config_refresh_outcome=hit_304");
54
54
  if (!currentAuth) {
55
- currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey);
55
+ currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey, options);
56
56
  }
57
57
  return;
58
58
  }
59
59
  if (!result.config) {
60
60
  console.warn("[AscendKit runtime] config_refresh_outcome=cold_fail reason=missing_config");
61
61
  if (!currentAuth) {
62
- currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey);
62
+ currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey, options);
63
63
  }
64
64
  return;
65
65
  }
@@ -68,6 +68,9 @@ export function createAscendKitAuthRuntime(options = {}) {
68
68
  secretKey,
69
69
  apiUrl,
70
70
  config: result.config,
71
+ appBaseUrl: options.appBaseUrl,
72
+ allowedHosts: options.allowedHosts,
73
+ trustedProxyHeaders: options.trustedProxyHeaders,
71
74
  waitlistRedirectPath: options.waitlistRedirectPath,
72
75
  rejectedRedirectPath: options.rejectedRedirectPath,
73
76
  });
@@ -84,7 +87,7 @@ export function createAscendKitAuthRuntime(options = {}) {
84
87
  catch (err) {
85
88
  console.warn("[AscendKit runtime] config_refresh_outcome=fallback_last_known_good", err instanceof Error ? err.message : err);
86
89
  if (!currentAuth) {
87
- currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey);
90
+ currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey, options);
88
91
  }
89
92
  }
90
93
  })();
@@ -97,7 +100,7 @@ export function createAscendKitAuthRuntime(options = {}) {
97
100
  async function getAuth() {
98
101
  await refreshAuth();
99
102
  if (!currentAuth) {
100
- currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey);
103
+ currentAuth = createDisabledAuth(publicKey, apiUrl, secretKey, options);
101
104
  }
102
105
  return currentAuth;
103
106
  }
@@ -0,0 +1,8 @@
1
+ import type { AscendKitAuthOptions } from "../shared/types";
2
+ type BaseUrlConfig = string | {
3
+ allowedHosts: string[];
4
+ fallback?: string;
5
+ } | undefined;
6
+ export declare function resolveAscendKitBaseUrlConfig(options: AscendKitAuthOptions): BaseUrlConfig;
7
+ export {};
8
+ //# sourceMappingURL=base-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-url.d.ts","sourceRoot":"","sources":["../../src/server/base-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,KAAK,aAAa,GACd,MAAM,GACN;IACA,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACC,SAAS,CAAC;AAqFd,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA6B1F"}
@@ -0,0 +1,95 @@
1
+ const loggedMessages = new Set();
2
+ function logBaseUrlResolution(message) {
3
+ if (loggedMessages.has(message))
4
+ return;
5
+ console.info(`[AscendKit] ${message}`);
6
+ loggedMessages.add(message);
7
+ }
8
+ function normalizeOrigin(url) {
9
+ const candidate = url.startsWith("http://") || url.startsWith("https://")
10
+ ? url
11
+ : `https://${url}`;
12
+ try {
13
+ return new URL(candidate).origin;
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ }
19
+ function normalizeHost(host) {
20
+ const origin = normalizeOrigin(host);
21
+ if (!origin)
22
+ return null;
23
+ try {
24
+ return new URL(origin).host;
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ function parseAllowedHosts(value) {
31
+ if (!value)
32
+ return [];
33
+ return value
34
+ .split(",")
35
+ .map((entry) => entry.trim())
36
+ .filter(Boolean)
37
+ .map((entry) => normalizeHost(entry) ?? entry)
38
+ .filter(Boolean);
39
+ }
40
+ function unique(values) {
41
+ return [...new Set(values.filter((value) => Boolean(value)))];
42
+ }
43
+ function pickBaseUrlSource(options) {
44
+ if (options.appBaseUrl) {
45
+ return { source: "options.appBaseUrl", value: options.appBaseUrl };
46
+ }
47
+ if (process.env.ASCENDKIT_APP_URL) {
48
+ return { source: "ASCENDKIT_APP_URL", value: process.env.ASCENDKIT_APP_URL };
49
+ }
50
+ if (process.env.NEXT_PUBLIC_ASCENDKIT_APP_URL) {
51
+ return {
52
+ source: "NEXT_PUBLIC_ASCENDKIT_APP_URL",
53
+ value: process.env.NEXT_PUBLIC_ASCENDKIT_APP_URL,
54
+ };
55
+ }
56
+ if (process.env.APP_URL) {
57
+ return { source: "APP_URL", value: process.env.APP_URL };
58
+ }
59
+ if (process.env.NEXT_PUBLIC_APP_URL) {
60
+ return { source: "NEXT_PUBLIC_APP_URL", value: process.env.NEXT_PUBLIC_APP_URL };
61
+ }
62
+ if (process.env.VERCEL_URL) {
63
+ return { source: "VERCEL_URL", value: `https://${process.env.VERCEL_URL}` };
64
+ }
65
+ return null;
66
+ }
67
+ function pickAllowedHosts(options) {
68
+ if (options.allowedHosts && options.allowedHosts.length > 0) {
69
+ return { source: "options.allowedHosts", values: options.allowedHosts };
70
+ }
71
+ const envHosts = parseAllowedHosts(process.env.ASCENDKIT_ALLOWED_HOSTS);
72
+ if (envHosts.length > 0) {
73
+ return { source: "ASCENDKIT_ALLOWED_HOSTS", values: envHosts };
74
+ }
75
+ return null;
76
+ }
77
+ export function resolveAscendKitBaseUrlConfig(options) {
78
+ const explicitBaseUrl = pickBaseUrlSource(options);
79
+ if (explicitBaseUrl) {
80
+ const staticBaseUrl = normalizeOrigin(explicitBaseUrl.value);
81
+ if (staticBaseUrl) {
82
+ logBaseUrlResolution(`base_url_resolution source=${explicitBaseUrl.source} using=${staticBaseUrl}`);
83
+ return staticBaseUrl;
84
+ }
85
+ logBaseUrlResolution(`invalid ${explicitBaseUrl.source}=${explicitBaseUrl.value}, using request origin from the customer web server host`);
86
+ }
87
+ const hostConfig = pickAllowedHosts(options);
88
+ if (hostConfig) {
89
+ const allowedHosts = unique(hostConfig.values.map((entry) => normalizeHost(entry) ?? entry));
90
+ logBaseUrlResolution(`no appBaseUrl/ASCENDKIT_APP_URL/NEXT_PUBLIC_ASCENDKIT_APP_URL/APP_URL/NEXT_PUBLIC_APP_URL/VERCEL_URL found, using request origin constrained by ${hostConfig.source}=${allowedHosts.join(",")}`);
91
+ return { allowedHosts };
92
+ }
93
+ logBaseUrlResolution("no appBaseUrl/ASCENDKIT_APP_URL/NEXT_PUBLIC_ASCENDKIT_APP_URL/APP_URL/NEXT_PUBLIC_APP_URL/VERCEL_URL found, using request origin from the customer web server host");
94
+ return undefined;
95
+ }
@@ -1,10 +1,10 @@
1
1
  export { AscendKitAuth } from "./ascendkit-auth";
2
2
  export { createAscendKitAuthRuntime } from "./auth-runtime";
3
+ export { createAuthRouteHandlers } from "./route-handlers";
3
4
  export { createAscendKitAdapter } from "./adapter";
4
5
  export { createAccessTokenHandler } from "./access-token";
5
6
  export { Analytics } from "./analytics";
6
7
  export { verifyWebhookSignature } from "./webhooks";
7
- export { toNextJsHandler } from "better-auth/next-js";
8
8
  export type { AscendKitAuthOptions } from "../shared/types";
9
9
  export type { AscendKitAuthRuntime } from "./auth-runtime";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export { AscendKitAuth } from "./ascendkit-auth";
2
2
  export { createAscendKitAuthRuntime } from "./auth-runtime";
3
+ export { createAuthRouteHandlers } from "./route-handlers";
3
4
  export { createAscendKitAdapter } from "./adapter";
4
5
  export { createAccessTokenHandler } from "./access-token";
5
6
  export { Analytics } from "./analytics";
6
7
  export { verifyWebhookSignature } from "./webhooks";
7
- export { toNextJsHandler } from "better-auth/next-js";
@@ -0,0 +1,15 @@
1
+ type AuthHandler = {
2
+ handler: (request: Request) => Promise<Response>;
3
+ } | ((request: Request) => Promise<Response>);
4
+ /**
5
+ * Create Next.js App Router route handlers for AscendKit auth.
6
+ */
7
+ export declare function createAuthRouteHandlers(auth: AuthHandler): {
8
+ GET: (request: Request) => Promise<Response>;
9
+ POST: (request: Request) => Promise<Response>;
10
+ PATCH: (request: Request) => Promise<Response>;
11
+ PUT: (request: Request) => Promise<Response>;
12
+ DELETE: (request: Request) => Promise<Response>;
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=route-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-handlers.d.ts","sourceRoot":"","sources":["../../src/server/route-handlers.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAClD,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE9C;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW;;;;;;EAExD"}
@@ -0,0 +1,7 @@
1
+ import { toNextJsHandler } from "better-auth/next-js";
2
+ /**
3
+ * Create Next.js App Router route handlers for AscendKit auth.
4
+ */
5
+ export function createAuthRouteHandlers(auth) {
6
+ return toNextJsHandler(auth);
7
+ }
@@ -1,4 +1,5 @@
1
- export declare const SDK_VERSION = "0.1.0";
1
+ import { SDK_VERSION } from "./version";
2
+ export { SDK_VERSION };
2
3
  export interface HttpClientOptions {
3
4
  publicKey: string;
4
5
  apiUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/shared/http-client.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgBD,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB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BtG;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,11 +1,12 @@
1
- export const SDK_VERSION = "0.1.0";
1
+ import { SDK_VERSION } from "./version";
2
+ export { SDK_VERSION };
2
3
  let upgradeWarned = false;
3
4
  function checkUpgradeHeader(res) {
4
5
  const upgrade = res.headers.get("X-AscendKit-Upgrade");
5
6
  if (upgrade === "recommended" && !upgradeWarned) {
6
7
  const latest = res.headers.get("X-AscendKit-Latest-Version") ?? "latest";
7
8
  console.warn(`[ascendkit] A newer SDK version (v${latest}) is available. ` +
8
- `You are running v${SDK_VERSION}. Run "npm update @ascendkit/nextjs" to upgrade.`);
9
+ `You are running v${SDK_VERSION}. Run "npm install @ascendkit/nextjs@latest" to upgrade.`);
9
10
  upgradeWarned = true;
10
11
  }
11
12
  }
@@ -2,6 +2,21 @@ export interface AscendKitAuthOptions {
2
2
  publicKey?: string;
3
3
  secretKey?: string;
4
4
  apiUrl?: string;
5
+ /**
6
+ * Public app origin used for auth callbacks and redirects.
7
+ * Example: "https://app.example.com"
8
+ */
9
+ appBaseUrl?: string;
10
+ /**
11
+ * Optional allowlist of request hosts for dynamic callback resolution.
12
+ * Useful for preview deployments or when appBaseUrl is not fixed.
13
+ */
14
+ allowedHosts?: string[];
15
+ /**
16
+ * Whether to trust x-forwarded-* headers when resolving request origin.
17
+ * Enable this only when your deployment is behind a trusted proxy.
18
+ */
19
+ trustedProxyHeaders?: boolean;
5
20
  /** Optional redirect path for waitlisted users in proxy social flows. */
6
21
  waitlistRedirectPath?: string;
7
22
  /** Optional redirect path for rejected users in proxy social flows. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CA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AK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,iEAAiE;IACjE,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IACrD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export declare const SDK_VERSION = "0.3.1";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/shared/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ export const SDK_VERSION = "0.3.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascendkit/nextjs",
3
- "version": "0.2.7",
3
+ "version": "0.3.1",
4
4
  "description": "AscendKit SDK for Next.js and React",
5
5
  "author": "ascendkit.dev",
6
6
  "license": "MIT",
@@ -37,24 +37,22 @@
37
37
  }
38
38
  },
39
39
  "scripts": {
40
- "build": "tsc",
40
+ "build": "rm -rf dist && node ./scripts/sync-version.mjs && tsc",
41
41
  "dev": "tsc --watch",
42
- "typecheck": "tsc --noEmit"
42
+ "typecheck": "node ./scripts/sync-version.mjs && tsc --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@daveyplate/better-auth-ui": "^3.3.15"
45
+ "@daveyplate/better-auth-ui": "^3.3.15",
46
+ "better-auth": "^1.5.5",
47
+ "better-call": "^1.3.2"
46
48
  },
47
49
  "peerDependencies": {
48
- "better-auth": "1.5.5",
49
- "better-call": "1.3.2",
50
50
  "next": ">=14",
51
51
  "react": ">=18",
52
52
  "react-dom": ">=18"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@better-auth/passkey": "^1.5.5",
56
- "better-auth": "^1.5.5",
57
- "better-call": "1.3.2",
58
56
  "@types/node": "^25.5.0",
59
57
  "@types/react": "^19",
60
58
  "typescript": "^5"