@ascendkit/nextjs 0.3.5 → 0.3.6

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/README.md CHANGED
@@ -117,6 +117,30 @@ const { track, flush } = useAnalytics();
117
117
  track("checkout.completed", { total: 99.99 });
118
118
  ```
119
119
 
120
+ ## Access tokens (frontend → backend)
121
+
122
+ If your app has a separate backend, use access tokens to authenticate API calls from the browser.
123
+
124
+ ```ts
125
+ // app/api/access-token/route.ts
126
+ import { authRuntime } from "@/lib/auth";
127
+ import { createAccessTokenHandler } from "@ascendkit/nextjs/server";
128
+
129
+ export const GET = createAccessTokenHandler({ authRuntime });
130
+ ```
131
+
132
+ ```tsx
133
+ import { useAccessToken } from "@ascendkit/nextjs";
134
+
135
+ const { getAccessToken } = useAccessToken();
136
+ const token = await getAccessToken();
137
+ fetch("https://api.example.com/data", {
138
+ headers: { Authorization: `Bearer ${token}` },
139
+ });
140
+ ```
141
+
142
+ Tokens are short-lived RS256 JWTs, cached in memory, and auto-refreshed. Verify on any backend using AscendKit's JWKS endpoint or the [Python SDK](https://ascendkit.dev/docs/python).
143
+
120
144
  ## Server-side analytics
121
145
 
122
146
  ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"auth-card.d.ts","sourceRoot":"","sources":["../../src/components/auth-card.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAK1E,UAAU,sBAAuB,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IAClE,iDAAiD;IACjD,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CA8J9D"}
1
+ {"version":3,"file":"auth-card.d.ts","sourceRoot":"","sources":["../../src/components/auth-card.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAK1E,UAAU,sBAAuB,SAAQ,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;IAClE,iDAAiD;IACjD,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAoM9D"}
@@ -124,10 +124,45 @@ export function AscendKitAuthCard(props) {
124
124
  --ak-notif-info-border: rgba(59, 130, 246, 0.2);
125
125
  }
126
126
  }
127
- ` })] })), _jsx(AuthView, { ...props, socialLayout: props.socialLayout ?? "vertical", classNames: {
128
- content: "overflow-x-hidden",
129
- continueWith: "w-full min-w-0",
130
- separator: "min-w-0 flex-1",
131
- ...props.classNames,
132
- } }), _jsx(BrandingBadge, {})] }));
127
+ ` })] })), _jsxs("div", { className: "ak-auth-view-wrapper", children: [_jsx(AuthView, { ...props, socialLayout: props.socialLayout ?? "vertical", classNames: {
128
+ content: "overflow-x-hidden",
129
+ continueWith: "w-full min-w-0",
130
+ separator: "min-w-0 flex-1",
131
+ ...props.classNames,
132
+ } }), _jsx("style", { children: `
133
+ /*
134
+ * Fallback styles for Better Auth UI's Tailwind utility classes.
135
+ * These ensure correct rendering when the host app's Tailwind config
136
+ * does not scan node_modules/@daveyplate/better-auth-ui.
137
+ * Each rule uses .ak-auth-view-wrapper to avoid leaking into the host app.
138
+ */
139
+ .ak-auth-view-wrapper .size-4 { width: 1rem; height: 1rem; }
140
+ .ak-auth-view-wrapper .size-5 { width: 1.25rem; height: 1.25rem; }
141
+ .ak-auth-view-wrapper .shrink-0,
142
+ .ak-auth-view-wrapper .flex-shrink-0 { flex-shrink: 0; }
143
+ .ak-auth-view-wrapper .w-full { width: 100%; }
144
+ .ak-auth-view-wrapper .flex { display: flex; }
145
+ .ak-auth-view-wrapper .grid { display: grid; }
146
+ .ak-auth-view-wrapper .items-center { align-items: center; }
147
+ .ak-auth-view-wrapper .justify-center { justify-content: center; }
148
+ .ak-auth-view-wrapper .gap-2 { gap: 0.5rem; }
149
+ .ak-auth-view-wrapper .gap-4 { gap: 1rem; }
150
+ .ak-auth-view-wrapper .gap-6 { gap: 1.5rem; }
151
+ .ak-auth-view-wrapper .flex-col { flex-direction: column; }
152
+ .ak-auth-view-wrapper .flex-row { flex-direction: row; }
153
+ .ak-auth-view-wrapper .flex-1 { flex: 1 1 0%; }
154
+ .ak-auth-view-wrapper .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
155
+ .ak-auth-view-wrapper .text-xs { font-size: 0.75rem; line-height: 1rem; }
156
+ .ak-auth-view-wrapper .text-lg { font-size: 1.125rem; line-height: 1.75rem; }
157
+ .ak-auth-view-wrapper .font-semibold { font-weight: 600; }
158
+ .ak-auth-view-wrapper .rounded-md { border-radius: 0.375rem; }
159
+ .ak-auth-view-wrapper .rounded-lg { border-radius: 0.5rem; }
160
+ .ak-auth-view-wrapper .min-w-0 { min-width: 0; }
161
+ .ak-auth-view-wrapper .overflow-x-hidden { overflow-x: hidden; }
162
+ .ak-auth-view-wrapper .text-center { text-align: center; }
163
+ .ak-auth-view-wrapper .p-2 { padding: 0.5rem; }
164
+ .ak-auth-view-wrapper .p-4 { padding: 1rem; }
165
+ .ak-auth-view-wrapper .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
166
+ .ak-auth-view-wrapper .h-9 { height: 2.25rem; }
167
+ ` })] }), _jsx(BrandingBadge, {})] }));
133
168
  }
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.3.5";
1
+ export declare const SDK_VERSION = "0.3.6";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.3.5";
1
+ export const SDK_VERSION = "0.3.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascendkit/nextjs",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "AscendKit SDK for Next.js and React",
5
5
  "author": "ascendkit.dev",
6
6
  "license": "MIT",