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

last-login-method/configuration

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

Last Login Method server configuration options

The server-side lastLoginMethod plugin accepts these configuration options: cookieName (string, default 'better-auth.last_used_login_method'), maxAge (number in seconds, default 2592000 or 30 days), storeInDatabase (boolean, default false), customResolveMethod (function taking GenericEndpointContext and returning string or null), beforeStoreCookie (async function for GDPR compliance hooks), and schema (object for custom field names when storeInDatabase is enabled).

Last Login Method client configuration options

The client-side lastLoginMethodClient plugin accepts cookieName (string, default 'better-auth.last_used_login_method', must match server-side configuration) and domain (string, required when using crossSubDomainCookies for proper cookie clearing across subdomains).

Last Login Method GDPR compliance

The last login method cookie is considered a non-essential cookie under GDPR regulations. To comply with GDPR, use the beforeStoreCookie hook to check for user consent before storing the cookie. The function receives the request context and lastUsedLoginMethod string, returning a boolean or Promise<boolean>. When beforeStoreCookie returns false or throws an error, the cookie will not be set, but authentication will still succeed normally.

Last Login Method custom provider tracking example

Use the customResolveMethod option to track custom authentication methods. The function receives the request context and can check ctx.path to detect custom providers. For example, check if ctx.path === '/saml/callback' to track SAML, or ctx.path === '/magic-link/verify' to track magic links. Return null to use default resolution logic.

Last Login Method cross-domain cookie support

The plugin automatically inherits cookie settings from Better Auth's centralized cookie system. When crossSubDomainCookies or crossOriginCookies is enabled in the Better Auth config, the plugin uses the same domain, secure, and sameSite settings as session cookies. For cross-subdomain setups, pass the domain option to lastLoginMethodClient() so clearLastUsedLoginMethod() can properly expire the cookie across subdomains.

Last Login Method database-only storage configuration

To store the last login method only in the database without setting cookies, combine storeInDatabase: true with beforeStoreCookie: () => false in the configuration.

Give your agent this brain