# auth

Identity and request scope: responsibilities, supported exports and extension points.

## Purpose [#purpose]

The Better Auth factory configures sessions, Organizations, admin, passkeys, two-factor, Expo and MCP OAuth. Request scope shares the authorized database/auth instance through one HTTP invocation. Outcome modules normalize sign-in and challenge results.

## Public exports [#public-exports]

| Subpath | Target |
| --- | --- |
| `.` | `./src/index.ts` |
| `./admin-audit` | `./src/admin-audit.ts` |
| `./errors` | `./src/errors.ts` |
| `./request-scope` | `./src/request-scope.ts` |
| `./server-session` | `./src/server-session.ts` |
| `./session-outcome` | `./src/session-outcome.ts` |
| `./two-factor-outcome` | `./src/two-factor-outcome.ts` |

These paths come from `packages/auth/package.json`. A `.` entry is the package root. Conditional targets distinguish platform or type resolution; consumers should import the subpath, not its source file.

## How to extend [#how-to-extend]

Change the factory for server behavior and the outcome modules for shared interpretations. Test revoked sessions, bans, impersonation and Organization membership. Do not export client constants through a server entry.

Read the [identity and request scope guide](/docs/features/auth) for the full flow.

## Key files [#key-files]

- [`packages/auth/package.json`](https://github.com/CarlosZiegler/doro/blob/main/packages/auth/package.json)

