@rc-tool/unified-auth-hosted-service 0.2.0 → 0.2.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 (2) hide show
  1. package/README.md +48 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,3 +3,51 @@
3
3
  Hosted Auth runtime for Unified Auth.
4
4
 
5
5
  Use this package to mount SDK-provided login pages, OAuth routes, session APIs, file/memory stores, and the `unified-auth` CLI.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @rc-tool/unified-auth-sdk @rc-tool/unified-auth-hosted-service
11
+ ```
12
+
13
+ ## Next.js Embedded Routes
14
+
15
+ ```ts
16
+ import { createFileAuthStore, createHostedAuthRouteHandlers } from "@rc-tool/unified-auth-hosted-service";
17
+
18
+ export const hostedAuth = createHostedAuthRouteHandlers({
19
+ allowDevLogin: process.env.AUTH_ALLOW_DEV_LOGIN !== "false",
20
+ applications: [
21
+ {
22
+ allowedRedirectURIs: [process.env.AUTH_ALLOWED_REDIRECT_URI ?? "http://localhost:3004/"],
23
+ clientId: process.env.AUTH_CLIENT_ID ?? "ai-pm",
24
+ name: process.env.AUTH_CLIENT_NAME ?? "AI PM",
25
+ redirectURI: process.env.AUTH_ALLOWED_REDIRECT_URI ?? "http://localhost:3004/",
26
+ },
27
+ ],
28
+ authBaseURL: process.env.AUTH_SERVICE_URL ?? "http://localhost:3004",
29
+ sessionSecret: process.env.AUTH_SESSION_SECRET!,
30
+ store: createFileAuthStore({
31
+ filePath: process.env.AUTH_STORE_FILE ?? ".auth/unified-auth-store.json",
32
+ }),
33
+ });
34
+ ```
35
+
36
+ ```ts
37
+ // app/login/route.ts
38
+ export { GET } from "@/lib/hosted-auth";
39
+ ```
40
+
41
+ ```ts
42
+ // app/api/auth/[...auth]/route.ts
43
+ export { GET, POST } from "@/lib/hosted-auth";
44
+ ```
45
+
46
+ ## CLI
47
+
48
+ ```bash
49
+ pnpm dlx @rc-tool/unified-auth-hosted-service init --app ai-pm --redirect http://localhost:3004/
50
+ pnpm dlx @rc-tool/unified-auth-hosted-service doctor
51
+ ```
52
+
53
+ The default store is file-based. Install `@rc-tool/unified-auth-prisma-store` only when `AUTH_STORE_PROVIDER=prisma`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-tool/unified-auth-hosted-service",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Embedded and standalone hosted auth runtime for Unified Auth.",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "README.md"
27
27
  ],
28
28
  "dependencies": {
29
- "@rc-tool/unified-auth-sdk": "^0.2.0",
29
+ "@rc-tool/unified-auth-sdk": "^0.2.1",
30
30
  "dotenv": "^17.4.2"
31
31
  },
32
32
  "scripts": {