new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Reference · all subjects

options/advanced

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

crossSubDomainCookies option fields

The crossSubDomainCookies option in advanced has the following fields: enabled (enable cross-subdomain cookies), additionalCookies (array of additional cookie names to share), domain (explicit domain for cookies; cookie domain is derived from resolved request host unless set explicitly; when enabled, domain derived from resolved request host unless explicitly set).

advanced.ipAddress option fields

The advanced.ipAddress option has the following fields: ipAddressHeaders (array of trusted header names to read client IP addresses from), disableIpTracking (disable IP address tracking), trustedProxies (reverse-proxy IPs or CIDR ranges; forwarded chain walked right to left, trusted hops skipped, first untrusted address used as client IP).

advanced.database option fields

The advanced.database option has the following fields: generateId (controls how record IDs generated; accepts custom function, false, 'serial', or 'uuid'; default: random base62 string), defaultFindManyLimit (default maximum number of records returned by findMany adapter method; default: 100), experimentalJoins (enable experimental joins).

advanced.cookies option structure

The advanced.cookies option allows customization of individual cookies. Each cookie can be specified with a key like 'session_token' containing an object with: name (custom cookie name) and attributes (object with cookie attributes like httpOnly and secure).

advanced.backgroundTasks option

The advanced.backgroundTasks option configures background task handling for deferred operations. It has a handler property that accepts a function like waitUntil from @vercel/functions or cloudflare:workers. Background tasks allow non-critical operations to run after response is sent, improving response times on serverless platforms. This introduces eventual consistency where response returns optimistic data before database is updated.

advanced option fields

The advanced option has the following fields: ipAddress (IP address configuration), useSecureCookies (force Secure cookie attribute in all environments; default: secure in production), disableCSRFCheck (disable all CSRF protection including origin header validation and Fetch Metadata checks; security risk), disableOriginCheck (disable URL validation for callbackURL, redirectTo, and redirect URLs; security risk), crossSubDomainCookies (configure cookies to be shared across subdomains), cookies (customize cookie names and attributes), defaultCookieAttributes (default attributes for all cookies), cookiePrefix (prefix for cookies), database (database configuration options), backgroundTasks (configure background task handling), skipTrailingSlashes (skip trailing slash validation in route matching; default: false).

advanced.database example code

import { betterAuth } from "better-auth"; export const auth = betterAuth({ advanced: { database: { generateId: "uuid", defaultFindManyLimit: 50, }, }, });

advanced.backgroundTasks example code - Vercel

import { betterAuth } from "better-auth"; import { waitUntil } from "@vercel/functions"; export const auth = betterAuth({ advanced: { backgroundTasks: { handler: waitUntil, }, }, });

advanced.backgroundTasks example code - Cloudflare Workers

import { betterAuth } from "better-auth"; import { waitUntil } from "cloudflare:workers"; export const auth = betterAuth({ advanced: { backgroundTasks: { handler: waitUntil, }, }, });

advanced example code

import { betterAuth } from "better-auth"; export const auth = betterAuth({ advanced: { ipAddress: { ipAddressHeaders: ["x-client-ip", "x-real-ip"], disableIpTracking: false }, useSecureCookies: true, disableCSRFCheck: false, disableOriginCheck: false, crossSubDomainCookies: { enabled: true, additionalCookies: ["custom_cookie"], domain: "example.com" }, cookies: { session_token: { name: "custom_session_token", attributes: { httpOnly: true, secure: true } } }, defaultCookieAttributes: { httpOnly: true, secure: true }, cookiePrefix: "myapp", database: { generateId: (((options: { model: LiteralUnion<Models, string>; size?: number; }) => { return "my-super-unique-id"; })) | false | "serial" | "uuid", defaultFindManyLimit: 100, experimentalJoins: false, }, backgroundTasks: { handler: (promise) => { /* e.g. waitUntil(promise) */ } }, skipTrailingSlashes: true }, })

Give your agent this brain