Skip to content

Commit 9794be7

Browse files
committed
fix: add AuthPlugin for improved authentication handling
1 parent d93089d commit 9794be7

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

apps/studio/api/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
2929
import { ObjectQLPlugin } from '@objectstack/objectql';
3030
import { InMemoryDriver } from '@objectstack/driver-memory';
3131
import { createHonoApp } from '@objectstack/hono';
32+
import { AuthPlugin } from '@objectstack/plugin-auth';
3233
import { getRequestListener } from '@hono/node-server';
3334
import type { Hono } from 'hono';
3435
import { createBrokerShim } from '../src/lib/create-broker-shim.js';
@@ -68,6 +69,15 @@ async function ensureKernel(): Promise<ObjectKernel> {
6869
await kernel.use(new DriverPlugin(new InMemoryDriver(), 'memory'));
6970
await kernel.use(new AppPlugin(studioConfig));
7071

72+
// Auth plugin — uses better-auth for real authentication
73+
const vercelUrl = process.env.VERCEL_URL
74+
? `https://${process.env.VERCEL_URL}`
75+
: 'http://localhost:3000';
76+
await kernel.use(new AuthPlugin({
77+
secret: process.env.AUTH_SECRET || 'dev-secret-please-change-in-production-min-32-chars',
78+
baseUrl: vercelUrl,
79+
}));
80+
7181
// Broker shim — bridges HttpDispatcher → ObjectQL engine
7282
(kernel as any).broker = createBrokerShim(kernel);
7383

apps/studio/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@objectstack/hono": "workspace:*",
2424
"@objectstack/metadata": "workspace:*",
2525
"@objectstack/objectql": "workspace:*",
26+
"@objectstack/plugin-auth": "workspace:*",
2627
"@objectstack/plugin-msw": "workspace:*",
2728
"@objectstack/runtime": "workspace:*",
2829
"@objectstack/spec": "workspace:*",

0 commit comments

Comments
 (0)