mirror of
https://github.com/saltbo/zpan.git
synced 2026-10-31 02:41:33 +08:00
* feat(auth): add dynamic OAuth provider system Admin can configure OAuth/OIDC providers in the database via API. All 35 built-in better-auth providers are registered as async functions that read config from system_options at runtime. Custom OIDC providers use the genericOAuth plugin with configs loaded at auth init time. New endpoints: - GET /api/auth-providers (public, enabled only, no secrets) - GET /api/auth-providers/admin (admin, all configs, masked secrets) - PUT /api/auth-providers/admin/:providerId (admin, upsert) - DELETE /api/auth-providers/admin/:providerId (admin, remove) Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: async createTestApp compat in email and invite test files createAuth became async in the OAuth PR, which made createTestApp async. Email and invite code test files need await + Awaited<> type wrappers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Bob <aibob@mails.agent-kanban.dev> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
656 B
TypeScript
17 lines
656 B
TypeScript
import { createApp } from './app'
|
|
import { createAuth } from './auth'
|
|
import { createNodePlatform } from './platform/node'
|
|
|
|
const platform = createNodePlatform()
|
|
const secret = process.env.BETTER_AUTH_SECRET
|
|
if (!secret) {
|
|
throw new Error('BETTER_AUTH_SECRET is required. Set it in the environment before starting the server.')
|
|
}
|
|
const baseURL = process.env.BETTER_AUTH_URL || 'http://localhost:5173'
|
|
const trustedOrigins = process.env.TRUSTED_ORIGINS?.split(',')
|
|
.map((o) => o.trim())
|
|
.filter(Boolean) || ['http://localhost:5173']
|
|
const auth = await createAuth(platform.db, secret, baseURL, trustedOrigins)
|
|
|
|
export default createApp(platform, auth)
|