This commit is contained in:
2026-02-24 19:31:30 +01:00
parent 28898fb081
commit 1bb9241116
16 changed files with 878 additions and 50 deletions

View File

@@ -2,7 +2,8 @@ import { db } from "@zendegi/db";
import * as schema from "@zendegi/db/schema/auth";
import { env } from "@zendegi/env/server";
import { betterAuth } from "better-auth";
import { anonymous } from "better-auth/plugins";
import { anonymous, jwt } from "better-auth/plugins";
import { oauthProvider } from "@better-auth/oauth-provider";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { tanstackStartCookies } from "better-auth/tanstack-start";
@@ -16,7 +17,19 @@ export const auth = betterAuth({
emailAndPassword: {
enabled: true,
},
plugins: [tanstackStartCookies(), anonymous()],
disabledPaths: ["/token"],
plugins: [
tanstackStartCookies(),
anonymous(),
jwt(),
oauthProvider({
loginPage: "/login",
consentPage: "/consent",
allowDynamicClientRegistration: true,
allowUnauthenticatedClientRegistration: true,
validAudiences: [env.BETTER_AUTH_URL, new URL(env.BETTER_AUTH_URL).href],
}),
],
advanced: {
database: {
generateId: "uuid",