fbla-cs-competition/frontend/src/lib/auth.ts
devaine a727696e5b
Some checks failed
/ build (push) Failing after 14s
/ deploy (push) Failing after 9s
feat(webpage): showing you the menu, hopefully it works??
2026-06-14 22:33:24 -05:00

31 lines
909 B
TypeScript

import { betterAuth } from "better-auth";
import { genericOAuth, username } from "better-auth/plugins";
import { Pool } from "pg";
import "dotenv/config";
export const auth = betterAuth({
baseURL: process.env.BASE_URL,
database: new Pool({
connectionString: process.env.PG_CONNECTION_STRING,
}),
plugins: [
username(),
genericOAuth({
config: [
{
providerId: "keycloak",
clientId: process.env.OAUTH_CLIENT_ID as string,
clientSecret: process.env.OAUTH_CLIENT_SECRET as string,
pkce: true,
authorizationUrl: `${process.env.OAUTH_ISSUER}/protocol/openid-connect/auth`,
tokenUrl: `${process.env.OAUTH_ISSUER}/protocol/openid-connect/token`,
userInfoUrl: `${process.env.OAUTH_ISSUER}/protocol/openid-connect/userinfo`,
scopes: ["openid", "profile", "email"],
},
],
}),
],
});