/** biome-ignore-all lint/style/noMagicNumbers: <30 days> */
import { betterAuth } from "better-auth";
import { genericOAuth, keycloak } from "better-auth/plugins";
import { tanstackStartCookies } from "better-auth/tanstack-start";
export const auth = betterAuth({
basePath: "/eagle/api/auth",
secret: process.env.BETTER_AUTH_SECRET ?? "",
trustedOrigins: ["https://<>.com/", "https://<>.com/<>/", process.env.BETTER_AUTH_URL ?? "", "http://localhost:3000"],
session: {
// Set session to last 30 days (in seconds)
expiresIn: 30 * 24 * 60 * 60,
updateAge: 24 * 60 * 60, // 1 day
// If you are using cookie caching, update its maxAge if needed
cookieCache: {
enabled: true,
maxAge: 30 * 24 * 60 * 60 // match the session lifetime
}
},
plugins: [genericOAuth({
config: [
keycloak({
clientId: "eagle-platform",
clientSecret: process.env.AUTH_KEYCLOAK_CLIENT_SECRET ?? "",
issuer: "https://sso.<>d.com/realms/<>",
}),
]
}), tanstackStartCookies()],
});
/** biome-ignore-all lint/style/noMagicNumbers: <30 days> */
import { betterAuth } from "better-auth";
import { genericOAuth, keycloak } from "better-auth/plugins";
import { tanstackStartCookies } from "better-auth/tanstack-start";
export const auth = betterAuth({
basePath: "/eagle/api/auth",
secret: process.env.BETTER_AUTH_SECRET ?? "",
trustedOrigins: ["https://<>.com/", "https://<>.com/<>/", process.env.BETTER_AUTH_URL ?? "", "http://localhost:3000"],
session: {
// Set session to last 30 days (in seconds)
expiresIn: 30 * 24 * 60 * 60,
updateAge: 24 * 60 * 60, // 1 day
// If you are using cookie caching, update its maxAge if needed
cookieCache: {
enabled: true,
maxAge: 30 * 24 * 60 * 60 // match the session lifetime
}
},
plugins: [genericOAuth({
config: [
keycloak({
clientId: "eagle-platform",
clientSecret: process.env.AUTH_KEYCLOAK_CLIENT_SECRET ?? "",
issuer: "https://sso.<>d.com/realms/<>",
}),
]
}), tanstackStartCookies()],
});