mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 12:27:44 +00:00
docs: updated autumn plugin page with latest org feature (#4705)
This commit is contained in:
@@ -50,6 +50,9 @@ import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
|
|||||||
<Step>
|
<Step>
|
||||||
### Add the Autumn plugin to your `auth` config
|
### Add the Autumn plugin to your `auth` config
|
||||||
|
|
||||||
|
<Tabs items={["User", "Organization", "User & Organization", "Custom"]}>
|
||||||
|
<Tab value="User">
|
||||||
|
|
||||||
```ts title="auth.ts"
|
```ts title="auth.ts"
|
||||||
import { autumn } from "autumn-js/better-auth";
|
import { autumn } from "autumn-js/better-auth";
|
||||||
|
|
||||||
@@ -58,9 +61,68 @@ import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
|
|||||||
plugins: [autumn()],
|
plugins: [autumn()],
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
<Tab value="Organization">
|
||||||
|
|
||||||
|
```ts title="auth.ts"
|
||||||
|
import { autumn } from "autumn-js/better-auth";
|
||||||
|
import { organization } from "better-auth/plugins";
|
||||||
|
|
||||||
|
export const auth = betterAuth({
|
||||||
|
// ...
|
||||||
|
plugins: [organization(), autumn({ customerScope: "organization" })],
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
<Tab value="User & Organization">
|
||||||
|
|
||||||
|
```ts title="auth.ts"
|
||||||
|
import { autumn } from "autumn-js/better-auth";
|
||||||
|
import { organization } from "better-auth/plugins";
|
||||||
|
|
||||||
|
export const auth = betterAuth({
|
||||||
|
// ...
|
||||||
|
plugins: [
|
||||||
|
organization(),
|
||||||
|
autumn({ customerScope: "user_and_organization" })
|
||||||
|
],
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
<Tab value="Custom">
|
||||||
|
|
||||||
|
```ts title="auth.ts"
|
||||||
|
import { autumn } from "autumn-js/better-auth";
|
||||||
|
import { organization } from "better-auth/plugins";
|
||||||
|
|
||||||
|
export const auth = betterAuth({
|
||||||
|
// ...
|
||||||
|
plugins: [
|
||||||
|
organization(),
|
||||||
|
autumn({
|
||||||
|
identify: async ({ session, organization }) => {
|
||||||
|
return {
|
||||||
|
customerId: "your_customer_id",
|
||||||
|
customerData: {
|
||||||
|
name: "Customer Name",
|
||||||
|
email: "customer@gmail.com",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
<Callout>
|
<Callout>
|
||||||
Autumn will auto-create your customers when they sign up, and assign them any
|
Autumn will auto-create your customers when they sign up, and assign them any
|
||||||
default plans you created (eg your Free plan)
|
default plans you created (eg your Free plan). You can choose who becomes a customer: individual users, organizations, both, or something custom like workspaces.
|
||||||
</Callout>
|
</Callout>
|
||||||
</Step>
|
</Step>
|
||||||
|
|
||||||
@@ -182,7 +244,7 @@ import { auth } from "@/lib/auth";
|
|||||||
const { allowed } = await auth.api.check({
|
const { allowed } = await auth.api.check({
|
||||||
headers: await headers(), // pass the request headers
|
headers: await headers(), // pass the request headers
|
||||||
body: {
|
body: {
|
||||||
feature_id: "messages",
|
featureId: "messages",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -192,7 +254,7 @@ const { allowed } = await auth.api.check({
|
|||||||
await auth.api.track({
|
await auth.api.track({
|
||||||
headers: await headers(),
|
headers: await headers(),
|
||||||
body: {
|
body: {
|
||||||
feature_id: "messages",
|
featureId: "messages",
|
||||||
value: 2,
|
value: 2,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"scripts:sync-orama": "node ./scripts/sync-orama.ts"
|
"scripts:sync-orama": "node ./scripts/sync-orama.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@better-auth/utils": "0.3.0",
|
||||||
"@hookform/resolvers": "^5.2.1",
|
"@hookform/resolvers": "^5.2.1",
|
||||||
"@oramacloud/client": "^2.1.4",
|
"@oramacloud/client": "^2.1.4",
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
"@radix-ui/react-dialog": "^1.1.15",
|
"@radix-ui/react-dialog": "^1.1.15",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||||
"@radix-ui/react-hover-card": "^1.1.15",
|
"@radix-ui/react-hover-card": "^1.1.15",
|
||||||
|
"@radix-ui/react-icons": "^1.3.2",
|
||||||
"@radix-ui/react-label": "^2.1.7",
|
"@radix-ui/react-label": "^2.1.7",
|
||||||
"@radix-ui/react-menubar": "^1.1.16",
|
"@radix-ui/react-menubar": "^1.1.16",
|
||||||
"@radix-ui/react-navigation-menu": "^1.2.14",
|
"@radix-ui/react-navigation-menu": "^1.2.14",
|
||||||
@@ -49,11 +51,13 @@
|
|||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"embla-carousel-react": "^8.6.0",
|
"embla-carousel-react": "^8.6.0",
|
||||||
"foxact": "^0.2.49",
|
"foxact": "^0.2.49",
|
||||||
|
"framer-motion": "^12.23.12",
|
||||||
"fumadocs-core": "15.7.8",
|
"fumadocs-core": "15.7.8",
|
||||||
"fumadocs-docgen": "2.1.0",
|
"fumadocs-docgen": "2.1.0",
|
||||||
"fumadocs-mdx": "11.8.3",
|
"fumadocs-mdx": "11.8.3",
|
||||||
"fumadocs-typescript": "^4.0.6",
|
"fumadocs-typescript": "^4.0.6",
|
||||||
"fumadocs-ui": "15.7.8",
|
"fumadocs-ui": "15.7.8",
|
||||||
|
"geist": "^1.4.2",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"input-otp": "^1.4.2",
|
"input-otp": "^1.4.2",
|
||||||
"jotai": "^2.13.1",
|
"jotai": "^2.13.1",
|
||||||
@@ -70,6 +74,7 @@
|
|||||||
"react-hook-form": "^7.62.0",
|
"react-hook-form": "^7.62.0",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-resizable-panels": "^3.0.5",
|
"react-resizable-panels": "^3.0.5",
|
||||||
|
"react-use-measure": "^2.1.7",
|
||||||
"recharts": "^3.1.2",
|
"recharts": "^3.1.2",
|
||||||
"rehype-highlight": "^7.0.2",
|
"rehype-highlight": "^7.0.2",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
@@ -84,6 +89,7 @@
|
|||||||
"@types/mdx": "^2.0.13",
|
"@types/mdx": "^2.0.13",
|
||||||
"@types/react": "^19.1.12",
|
"@types/react": "^19.1.12",
|
||||||
"@types/react-dom": "^19.1.9",
|
"@types/react-dom": "^19.1.9",
|
||||||
|
"mini-svg-data-uri": "^1.4.4",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"tailwindcss": "^4.1.13",
|
"tailwindcss": "^4.1.13",
|
||||||
"typescript": "^5.9.2"
|
"typescript": "^5.9.2"
|
||||||
|
|||||||
26
pnpm-lock.yaml
generated
26
pnpm-lock.yaml
generated
@@ -168,7 +168,7 @@ importers:
|
|||||||
version: 0.5.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
version: 0.5.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
'@react-three/fiber':
|
'@react-three/fiber':
|
||||||
specifier: ^8.18.0
|
specifier: ^8.18.0
|
||||||
version: 8.18.0(1a7d56a84bc02e5ad1bde2480f0aeeca)
|
version: 8.18.0(de6zoezpf3ukbgngf33jdfxfpq)
|
||||||
'@tanstack/react-query':
|
'@tanstack/react-query':
|
||||||
specifier: ^5.85.9
|
specifier: ^5.85.9
|
||||||
version: 5.85.9(react@19.1.1)
|
version: 5.85.9(react@19.1.1)
|
||||||
@@ -314,6 +314,9 @@ importers:
|
|||||||
|
|
||||||
docs:
|
docs:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@better-auth/utils':
|
||||||
|
specifier: 0.3.0
|
||||||
|
version: 0.3.0
|
||||||
'@hookform/resolvers':
|
'@hookform/resolvers':
|
||||||
specifier: ^5.2.1
|
specifier: ^5.2.1
|
||||||
version: 5.2.1(react-hook-form@7.62.0(react@19.1.1))
|
version: 5.2.1(react-hook-form@7.62.0(react@19.1.1))
|
||||||
@@ -350,6 +353,9 @@ importers:
|
|||||||
'@radix-ui/react-hover-card':
|
'@radix-ui/react-hover-card':
|
||||||
specifier: ^1.1.15
|
specifier: ^1.1.15
|
||||||
version: 1.1.15(@types/react-dom@19.1.9(@types/react@19.1.12))(@types/react@19.1.12)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
version: 1.1.15(@types/react-dom@19.1.9(@types/react@19.1.12))(@types/react@19.1.12)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
|
'@radix-ui/react-icons':
|
||||||
|
specifier: ^1.3.2
|
||||||
|
version: 1.3.2(react@19.1.1)
|
||||||
'@radix-ui/react-label':
|
'@radix-ui/react-label':
|
||||||
specifier: ^2.1.7
|
specifier: ^2.1.7
|
||||||
version: 2.1.7(@types/react-dom@19.1.9(@types/react@19.1.12))(@types/react@19.1.12)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
version: 2.1.7(@types/react-dom@19.1.9(@types/react@19.1.12))(@types/react@19.1.12)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
@@ -425,6 +431,9 @@ importers:
|
|||||||
foxact:
|
foxact:
|
||||||
specifier: ^0.2.49
|
specifier: ^0.2.49
|
||||||
version: 0.2.49(react@19.1.1)
|
version: 0.2.49(react@19.1.1)
|
||||||
|
framer-motion:
|
||||||
|
specifier: ^12.23.12
|
||||||
|
version: 12.23.12(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
fumadocs-core:
|
fumadocs-core:
|
||||||
specifier: 15.7.8
|
specifier: 15.7.8
|
||||||
version: 15.7.8(@oramacloud/client@2.1.4)(@tanstack/react-router@1.131.27(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.12)(algoliasearch@5.36.0)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(sass@1.90.0))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
version: 15.7.8(@oramacloud/client@2.1.4)(@tanstack/react-router@1.131.27(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react@19.1.12)(algoliasearch@5.36.0)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(sass@1.90.0))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
@@ -440,6 +449,9 @@ importers:
|
|||||||
fumadocs-ui:
|
fumadocs-ui:
|
||||||
specifier: 15.7.8
|
specifier: 15.7.8
|
||||||
version: 15.7.8(@oramacloud/client@2.1.4)(@tanstack/react-router@1.131.27(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react-dom@19.1.9(@types/react@19.1.12))(@types/react@19.1.12)(algoliasearch@5.36.0)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(sass@1.90.0))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(tailwindcss@4.1.13)
|
version: 15.7.8(@oramacloud/client@2.1.4)(@tanstack/react-router@1.131.27(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@types/react-dom@19.1.9(@types/react@19.1.12))(@types/react@19.1.12)(algoliasearch@5.36.0)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(sass@1.90.0))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(tailwindcss@4.1.13)
|
||||||
|
geist:
|
||||||
|
specifier: ^1.4.2
|
||||||
|
version: 1.4.2(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(sass@1.90.0))
|
||||||
gray-matter:
|
gray-matter:
|
||||||
specifier: ^4.0.3
|
specifier: ^4.0.3
|
||||||
version: 4.0.3
|
version: 4.0.3
|
||||||
@@ -488,6 +500,9 @@ importers:
|
|||||||
react-resizable-panels:
|
react-resizable-panels:
|
||||||
specifier: ^3.0.5
|
specifier: ^3.0.5
|
||||||
version: 3.0.5(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
version: 3.0.5(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
|
react-use-measure:
|
||||||
|
specifier: ^2.1.7
|
||||||
|
version: 2.1.7(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
|
||||||
recharts:
|
recharts:
|
||||||
specifier: ^3.1.2
|
specifier: ^3.1.2
|
||||||
version: 3.1.2(@types/react@19.1.12)(react-dom@19.1.1(react@19.1.1))(react-is@18.3.1)(react@19.1.1)(redux@5.0.1)
|
version: 3.1.2(@types/react@19.1.12)(react-dom@19.1.1(react@19.1.1))(react-is@18.3.1)(react@19.1.1)(redux@5.0.1)
|
||||||
@@ -525,6 +540,9 @@ importers:
|
|||||||
'@types/react-dom':
|
'@types/react-dom':
|
||||||
specifier: ^19.1.9
|
specifier: ^19.1.9
|
||||||
version: 19.1.9(@types/react@19.1.12)
|
version: 19.1.9(@types/react@19.1.12)
|
||||||
|
mini-svg-data-uri:
|
||||||
|
specifier: ^1.4.4
|
||||||
|
version: 1.4.4
|
||||||
postcss:
|
postcss:
|
||||||
specifier: ^8.5.6
|
specifier: ^8.5.6
|
||||||
version: 8.5.6
|
version: 8.5.6
|
||||||
@@ -552,7 +570,7 @@ importers:
|
|||||||
version: 0.15.3(solid-js@1.9.9)
|
version: 0.15.3(solid-js@1.9.9)
|
||||||
'@solidjs/start':
|
'@solidjs/start':
|
||||||
specifier: ^1.1.7
|
specifier: ^1.1.7
|
||||||
version: 1.1.7(7c37fd26a8096bc07b4eef39619c825a)
|
version: 1.1.7(ccvduuxloi3j37iwckcwkycibi)
|
||||||
better-auth:
|
better-auth:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../../packages/better-auth
|
version: link:../../../packages/better-auth
|
||||||
@@ -15935,7 +15953,7 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 19.1.12
|
'@types/react': 19.1.12
|
||||||
|
|
||||||
'@react-three/fiber@8.18.0(1a7d56a84bc02e5ad1bde2480f0aeeca)':
|
'@react-three/fiber@8.18.0(de6zoezpf3ukbgngf33jdfxfpq)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/runtime': 7.28.3
|
'@babel/runtime': 7.28.3
|
||||||
'@types/react-reconciler': 0.26.7
|
'@types/react-reconciler': 0.26.7
|
||||||
@@ -16388,7 +16406,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
solid-js: 1.9.9
|
solid-js: 1.9.9
|
||||||
|
|
||||||
'@solidjs/start@1.1.7(7c37fd26a8096bc07b4eef39619c825a)':
|
'@solidjs/start@1.1.7(ccvduuxloi3j37iwckcwkycibi)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tanstack/server-functions-plugin': 1.121.21(vite@7.1.5(@types/node@24.4.0)(jiti@2.5.1)(less@4.4.1)(lightningcss@1.30.1)(sass@1.90.0)(terser@5.44.0)(tsx@4.20.5)(yaml@2.8.1))
|
'@tanstack/server-functions-plugin': 1.121.21(vite@7.1.5(@types/node@24.4.0)(jiti@2.5.1)(less@4.4.1)(lightningcss@1.30.1)(sass@1.90.0)(terser@5.44.0)(tsx@4.20.5)(yaml@2.8.1))
|
||||||
'@vinxi/plugin-directives': 0.5.1(vinxi@0.5.8(@azure/identity@4.11.1)(@libsql/client@0.15.14)(@netlify/blobs@10.0.8)(@types/node@24.4.0)(better-sqlite3@12.2.0)(db0@0.3.2(@libsql/client@0.15.14)(better-sqlite3@12.2.0)(drizzle-orm@0.44.5(@cloudflare/workers-types@4.20250903.0)(@libsql/client@0.15.14)(@prisma/client@5.22.0(prisma@5.22.0))(@types/better-sqlite3@7.6.13)(@types/pg@8.15.5)(better-sqlite3@12.2.0)(bun-types@1.2.21(@types/react@19.1.12))(kysely@0.28.5)(mysql2@3.14.4)(pg@8.16.3)(prisma@5.22.0))(mysql2@3.14.4))(drizzle-orm@0.44.5(@cloudflare/workers-types@4.20250903.0)(@libsql/client@0.15.14)(@prisma/client@5.22.0(prisma@5.22.0))(@types/better-sqlite3@7.6.13)(@types/pg@8.15.5)(better-sqlite3@12.2.0)(bun-types@1.2.21(@types/react@19.1.12))(kysely@0.28.5)(mysql2@3.14.4)(pg@8.16.3)(prisma@5.22.0))(ioredis@5.7.0)(jiti@2.5.1)(less@4.4.1)(lightningcss@1.30.1)(mysql2@3.14.4)(sass@1.90.0)(terser@5.44.0)(tsx@4.20.5)(yaml@2.8.1))
|
'@vinxi/plugin-directives': 0.5.1(vinxi@0.5.8(@azure/identity@4.11.1)(@libsql/client@0.15.14)(@netlify/blobs@10.0.8)(@types/node@24.4.0)(better-sqlite3@12.2.0)(db0@0.3.2(@libsql/client@0.15.14)(better-sqlite3@12.2.0)(drizzle-orm@0.44.5(@cloudflare/workers-types@4.20250903.0)(@libsql/client@0.15.14)(@prisma/client@5.22.0(prisma@5.22.0))(@types/better-sqlite3@7.6.13)(@types/pg@8.15.5)(better-sqlite3@12.2.0)(bun-types@1.2.21(@types/react@19.1.12))(kysely@0.28.5)(mysql2@3.14.4)(pg@8.16.3)(prisma@5.22.0))(mysql2@3.14.4))(drizzle-orm@0.44.5(@cloudflare/workers-types@4.20250903.0)(@libsql/client@0.15.14)(@prisma/client@5.22.0(prisma@5.22.0))(@types/better-sqlite3@7.6.13)(@types/pg@8.15.5)(better-sqlite3@12.2.0)(bun-types@1.2.21(@types/react@19.1.12))(kysely@0.28.5)(mysql2@3.14.4)(pg@8.16.3)(prisma@5.22.0))(ioredis@5.7.0)(jiti@2.5.1)(less@4.4.1)(lightningcss@1.30.1)(mysql2@3.14.4)(sass@1.90.0)(terser@5.44.0)(tsx@4.20.5)(yaml@2.8.1))
|
||||||
|
|||||||
Reference in New Issue
Block a user