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 · Plugins · all subjects

two-factor/api

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

Disabling 2FA endpoint and parameters

POST /two-factor/disable requires session. Parameters: password (string, optional, required for credential accounts unless allowPasswordless is true).

Enabling 2FA endpoint and parameters

POST /two-factor/enable requires session. Parameters: password (string, optional, required for credential accounts unless allowPasswordless is true) and issuer (string, optional, defaults to app-name from config). Returns totpURI and backupCodes. Note: twoFactorEnabled is not set to true until user verifies their TOTP code, unless skipVerificationOnEnable is true.

auth.api 2FA server flow with cookies

When calling auth.api.signInEmail on the server and the user has 2FA enabled, it returns twoFactorRedirect set to true. This isn't inferred in TypeScript, so check using 'in' operator. authClient.twoFactor methods handle cookies in browser automatically, but continuing 2FA flow with auth.api on server requires passing relevant headers so Better Auth can read current 2FA state and set resulting 2FA/session cookies. If chaining multiple auth.api calls, forward cookies from previous auth response into next call.

Give your agent this brain