.
All checks were successful
Test action / Print hello world (push) Successful in 6m38s

This commit is contained in:
Chris Kruining 2025-09-22 15:33:18 +02:00
parent 4f5bbac05e
commit a502a50176
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
46 changed files with 2561 additions and 91 deletions

51
src/auth.server.ts Normal file
View file

@ -0,0 +1,51 @@
import { betterAuth } from "better-auth";
import { genericOAuth } from "better-auth/plugins";
import { Database } from "bun:sqlite";
export const auth = betterAuth({
appName: "Streamarr",
basePath: "/api/auth",
database: new Database('auth.sqlite', { create: true }),
logger: {
level: "debug",
log(level, message, ...args) {
console.log(level, message, {args});
},
},
user: {
additionalFields: {
name: {
type: "string",
nullable: true,
},
username: {
type: "string",
nullable: true,
},
},
},
plugins: [
genericOAuth({
config: [
{
providerId: "zitadel",
clientId: "",
clientSecret: "",
discoveryUrl: "https://auth.amarth.cloud/.well-known/openid-configuration",
scopes: [
"offline_access",
"openid",
"email",
"picture",
"profile",
"groups",
],
accessType: "offline",
pkce: true,
mapProfileToUser: ({ id, name, email, image, preferred_username, emailVerified }) =>
({ id, name, email, emailVerified, image, username: preferred_username }),
},
],
}),
],
});