Better Auth is a TypeScript-first authentication library with a plugin architecture that keeps your bundle lean. Features like two-factor auth, passkeys, and social providers are discrete plugins with co-designed server and client types.
0 / 5 completed
1 / 5
How does Better Auth handle feature extensibility?
Better Auth's plugin architecture lets you add only the features you need. Plugins like twoFactor(), passkey(), organization(), and magicLink() are installed by adding them to the plugins array in betterAuth({ plugins: [...] }). Each plugin extends both the server handler and the generated client types.
2 / 5
What does betterAuth() return on the server side?
betterAuth() creates the auth server instance. Its handler property is a platform-agnostic HTTP handler you mount at a path like /api/auth/[...all] (Next.js) or /auth/* (Hono). The instance also exposes an api object for server-side calls without HTTP overhead.
3 / 5
How does Better Auth handle social OAuth providers?
Social providers in Better Auth are configured in the socialProviders key: socialProviders: { github: { clientId: '...', clientSecret: '...' } }. Better Auth handles the redirect, callback, token exchange, and account linking. The client SDK exposes auth.signIn.social({ provider: 'github' }).
4 / 5
What is the passkey plugin in Better Auth?
The passkey plugin adds full WebAuthn support to Better Auth. It exposes passkey.addPasskey() for registration and handles the challenge/response flow for authentication. Passkeys are stored in the database and associated with user accounts, enabling passwordless sign-in with platform authenticators.
5 / 5
How is the Better Auth client generated and why does it have full type safety?
createAuthClient() accepts the same plugins as the server config: createAuthClient({ plugins: [twoFactorClient()] }). TypeScript infers the extended client API from the plugin types, so auth.twoFactor.sendOtp() is fully typed without code generation. This co-design of server and client types is a core Better Auth design principle.