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/account

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

account option fields

The account option has the following fields: modelName (model name for account), fields (map fields to different column names), encryptOAuthTokens (encrypt OAuth tokens before storing in database; default: false), updateAccountOnSignIn (if enabled, update user account data on sign in with latest provider data), storeStateStrategy (where to store OAuth state: 'cookie' stores in encrypted cookie (stateless), 'database' stores in verification storage/table; defaults to 'database' when database or secondaryStorage configured, 'cookie' only when neither set), storeAccountCookie (store provider account data after OAuth flow in encrypted cookie; useful for database-less flows; default: false; automatically true if no database provided), accountLinking (configuration for account linking).

account.accountLinking option fields

The account.accountLinking option has the following fields: enabled (enable account linking; default: true), disableImplicitLinking (disable automatic account linking on OAuth sign-in; when true, same-email OAuth sign-in for existing user rejected with account_not_linked instead of implicit linking even for verified emails or trustedProviders; new users can still sign up via OAuth and authenticated users can still link explicitly; default: false), trustedProviders (list of trusted providers; can be static array or async function based on request), allowDifferentEmails (allow users to link accounts with different email addresses), allowUnlinkingAll (allow users to unlink all accounts), updateUserInfoOnLink (when linking, copy provider's profile (name, image, and mapProfileToUser fields) onto local user; local email and emailVerified never changed; default: false).

account example code

import { betterAuth } from "better-auth"; export const auth = betterAuth({ account: { modelName: "accounts", fields: { userId: "user_id" }, encryptOAuthTokens: true, // Encrypt OAuth tokens before storing them in the database storeStateStrategy: "database", // Store OAuth state payload in verification storage storeAccountCookie: true, // Store provider account data after OAuth flow in an encrypted cookie (useful for database-less flows) accountLinking: { enabled: true, trustedProviders: ["google", "github", "email-password"], // or async (request) => ["google", "github"] allowDifferentEmails: false } }, })

account.storeAccountCookie with getAccountCookie example

import { createAuthMiddleware } from "better-auth/api"; import { getAccountCookie } from "better-auth/cookies"; const hook = createAuthMiddleware(async (ctx) => { const account = await getAccountCookie(ctx); });

Give your agent this brain